Compare commits
300 Commits
v6.1.2
...
fixes/defa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5645141f93 | ||
|
|
da2f22d504 | ||
|
|
0ee032a10d | ||
|
|
03a01c02c4 | ||
|
|
b607a59875 | ||
|
|
34f2221b02 | ||
|
|
b81c6825cf | ||
|
|
852e9ff311 | ||
|
|
92df32dfaa | ||
|
|
eacbde37e2 | ||
|
|
74384f14e4 | ||
|
|
027afa71f1 | ||
|
|
993918f47c | ||
|
|
7eaf3174ab | ||
|
|
297390ae63 | ||
|
|
01ab360ef3 | ||
|
|
1c2f3cd552 | ||
|
|
bc4a47421a | ||
|
|
0763b5135d | ||
|
|
253975ce72 | ||
|
|
9af850dbaa | ||
|
|
96b616be89 | ||
|
|
2b9f8ce4a6 | ||
|
|
fa6c8d864e | ||
|
|
c957f136aa | ||
|
|
697dc10d76 | ||
|
|
d47b502d86 | ||
|
|
6b02184e99 | ||
|
|
64342838fd | ||
|
|
346f243bc0 | ||
|
|
443adc50da | ||
|
|
cebf0e0de1 | ||
|
|
e41368daac | ||
|
|
d1efca2ae1 | ||
|
|
c56f664811 | ||
|
|
6f373aed33 | ||
|
|
d1ce1b6f18 | ||
|
|
24a3e0ee83 | ||
|
|
d3fbbec92c | ||
|
|
9820ab34d7 | ||
|
|
aa333bcf0b | ||
|
|
ba56746f57 | ||
|
|
dcec4ba5e2 | ||
|
|
12e9d2adeb | ||
|
|
c3356ab765 | ||
|
|
4446b2311d | ||
|
|
6b94ef6adc | ||
|
|
a0d5774635 | ||
|
|
291fa1cd29 | ||
|
|
58286c9cab | ||
|
|
1e43d88e06 | ||
|
|
da701677c7 | ||
|
|
30d33310ae | ||
|
|
bbb8ecfee4 | ||
|
|
8988a5dfc3 | ||
|
|
ed5b4ca0a2 | ||
|
|
07bafa9508 | ||
|
|
a1cfa45344 | ||
|
|
df8f6a8d2b | ||
|
|
5b86c02366 | ||
|
|
41479b1ec7 | ||
|
|
6adaa32286 | ||
|
|
a599f0c923 | ||
|
|
4db4bf7be4 | ||
|
|
04661d5441 | ||
|
|
3a5ed031bf | ||
|
|
60baaae192 | ||
|
|
8508594a2f | ||
|
|
e0b464dcec | ||
|
|
bd3ba9a5f7 | ||
|
|
a65ac1ccdf | ||
|
|
ffabc9c331 | ||
|
|
a6a742d8d8 | ||
|
|
2e632a3d2d | ||
|
|
c32f099053 | ||
|
|
c752e1670c | ||
|
|
1405e17251 | ||
|
|
15122bbb55 | ||
|
|
c18349d75f | ||
|
|
521961457d | ||
|
|
6a3a38b6f6 | ||
|
|
40aca9709a | ||
|
|
9e6f23c8c7 | ||
|
|
6afbf1b152 | ||
|
|
af91ffb2da | ||
|
|
94bef046b8 | ||
|
|
bd4061e023 | ||
|
|
5bda73f151 | ||
|
|
b56bcd3596 | ||
|
|
999605b591 | ||
|
|
d3a45f73cf | ||
|
|
0d40979724 | ||
|
|
81efa7d84e | ||
|
|
a7d1657111 | ||
|
|
8ea8ff05e5 | ||
|
|
6398805fc3 | ||
|
|
119ed9c882 | ||
|
|
32d8d8c50e | ||
|
|
ae9cf1e5b6 | ||
|
|
d019e62d39 | ||
|
|
b70a5280f9 | ||
|
|
cbe5a9bc8a | ||
|
|
3fd0853fd0 | ||
|
|
2e7aa01abe | ||
|
|
896f038054 | ||
|
|
48979ce177 | ||
|
|
e12935f7fa | ||
|
|
6400034435 | ||
|
|
269414e4f2 | ||
|
|
dee6ebf8e0 | ||
|
|
105c94aea9 | ||
|
|
0af205dade | ||
|
|
6349d52803 | ||
|
|
65de9c5e07 | ||
|
|
ebfc395e78 | ||
|
|
5c8c2ca027 | ||
|
|
924f5287f7 | ||
|
|
7560afb8c4 | ||
|
|
8a24a47475 | ||
|
|
fb52038e7c | ||
|
|
ffb605a37c | ||
|
|
343aacab85 | ||
|
|
96d69b654d | ||
|
|
2e1c3fb51b | ||
|
|
3e4b371bf4 | ||
|
|
b1464e028c | ||
|
|
0a841ddbb8 | ||
|
|
af86c6138d | ||
|
|
f6545be410 | ||
|
|
c015264181 | ||
|
|
9c6e8d57aa | ||
|
|
11e3487263 | ||
|
|
a01cb26aac | ||
|
|
e289e95721 | ||
|
|
b082d27c42 | ||
|
|
39ea15a27a | ||
|
|
4fe6632167 | ||
|
|
1a771e6ab9 | ||
|
|
7f761000b4 | ||
|
|
cb4ed92639 | ||
|
|
540b09c506 | ||
|
|
0b8a3ee9a5 | ||
|
|
1e09320ebe | ||
|
|
ee36497acf | ||
|
|
d7ac8ef618 | ||
|
|
244e4ec11f | ||
|
|
917005ceb4 | ||
|
|
90a344af0b | ||
|
|
ecf522243b | ||
|
|
705411eb4d | ||
|
|
3b4a2b0f5b | ||
|
|
a19a508a80 | ||
|
|
9e2987e680 | ||
|
|
1e1aea2eb0 | ||
|
|
33fd904c18 | ||
|
|
dc20305db6 | ||
|
|
a0a5ca1f40 | ||
|
|
064e696521 | ||
|
|
c1949ffb0d | ||
|
|
18e2ec4dad | ||
|
|
6f8c3ca167 | ||
|
|
cbdce994b8 | ||
|
|
051830dff4 | ||
|
|
2eaab6d9fb | ||
|
|
fa0a88289a | ||
|
|
88c40c9c14 | ||
|
|
f15e14f905 | ||
|
|
c21a7db3c1 | ||
|
|
bb0eaf8b8d | ||
|
|
3078cab7ee | ||
|
|
15bb943210 | ||
|
|
f51dd15893 | ||
|
|
346ace9444 | ||
|
|
ecac4718fe | ||
|
|
4027acee46 | ||
|
|
5aa99a15d8 | ||
|
|
016502f637 | ||
|
|
5d1f294f0e | ||
|
|
981c3a430d | ||
|
|
24adcdb586 | ||
|
|
1163af3c10 | ||
|
|
232e84acf7 | ||
|
|
5d60a38a0e | ||
|
|
c1c2c38995 | ||
|
|
44231fa52c | ||
|
|
44b8558e38 | ||
|
|
d3c44a462e | ||
|
|
a569a99e61 | ||
|
|
e648da9dc5 | ||
|
|
76191a09ed | ||
|
|
1b8b117f4e | ||
|
|
3df175fb3e | ||
|
|
44d8b2fd5e | ||
|
|
e0df8cc4aa | ||
|
|
af681d8190 | ||
|
|
2bc4235368 | ||
|
|
5b33c00e9f | ||
|
|
48e4ec8cf5 | ||
|
|
b5695c9ab7 | ||
|
|
6d3bf1e5f5 | ||
|
|
9b5a67e31f | ||
|
|
ba37a9db8c | ||
|
|
9dc7fc93fb | ||
|
|
a5555a1c67 | ||
|
|
d76f420f4e | ||
|
|
d8f22880d6 | ||
|
|
ec8cb1b09e | ||
|
|
4845a88c68 | ||
|
|
73c2202d94 | ||
|
|
0d37d1a905 | ||
|
|
83cf106ce5 | ||
|
|
7debf126d6 | ||
|
|
c5c87ea0ca | ||
|
|
8169206943 | ||
|
|
22d9df304b | ||
|
|
14c61e4c17 | ||
|
|
a4a676ef0b | ||
|
|
299e546021 | ||
|
|
5a9c2925c3 | ||
|
|
149184dc3c | ||
|
|
ef160b0e15 | ||
|
|
f4ca29b4a8 | ||
|
|
9591442f1e | ||
|
|
743e852998 | ||
|
|
2faa73f983 | ||
|
|
d37aaee4c8 | ||
|
|
a9d175a396 | ||
|
|
35039cd590 | ||
|
|
c85a33be6a | ||
|
|
d44e667697 | ||
|
|
d0212d4bda | ||
|
|
011726154c | ||
|
|
af03b9f140 | ||
|
|
8df9db76bc | ||
|
|
8725d40f8d | ||
|
|
4b8a08edc1 | ||
|
|
1a407dc05b | ||
|
|
00fd541963 | ||
|
|
eda5bbf305 | ||
|
|
df6b4ff349 | ||
|
|
efaed3d02c | ||
|
|
ba4fc146e2 | ||
|
|
1916594d27 | ||
|
|
537aa04c9a | ||
|
|
889be83762 | ||
|
|
2cb1545b83 | ||
|
|
ad7a1d6c3b | ||
|
|
1c60d686bd | ||
|
|
cd389368f7 | ||
|
|
d3675831bb | ||
|
|
84134b45e6 | ||
|
|
b1e68be545 | ||
|
|
d94bed3f57 | ||
|
|
aabcf22b40 | ||
|
|
af549a0be9 | ||
|
|
a65b8025b6 | ||
|
|
cc88a361ca | ||
|
|
f5122b01b1 | ||
|
|
0f3c5d10ba | ||
|
|
73fd0a24ca | ||
|
|
4b4c228f1a | ||
|
|
b72c6b7afc | ||
|
|
c2c009a018 | ||
|
|
17e81af4cd | ||
|
|
ffce6ec327 | ||
|
|
60ef5686ab | ||
|
|
af0872dc23 | ||
|
|
30a7a31724 | ||
|
|
67d021e457 | ||
|
|
7108156072 | ||
|
|
a4b93d4bbd | ||
|
|
f849fcca89 | ||
|
|
fd9616683c | ||
|
|
3d470d6f2f | ||
|
|
53513d93fa | ||
|
|
f5fac50e91 | ||
|
|
36210f1c6a | ||
|
|
48fb4f2439 | ||
|
|
fb467d9078 | ||
|
|
4fee5ece43 | ||
|
|
4bb40adfce | ||
|
|
06ce40ac08 | ||
|
|
a8b6a4a259 | ||
|
|
a60ee7736b | ||
|
|
d0eb3cfc9b | ||
|
|
19150aeb44 | ||
|
|
cde2ba7720 | ||
|
|
6b2fe582ca | ||
|
|
7e2546b31f | ||
|
|
7b29ddd283 | ||
|
|
d37605ff18 | ||
|
|
6de48b4dc8 | ||
|
|
5558a005b9 | ||
|
|
bb09f0168f | ||
|
|
4ed728d954 | ||
|
|
bbecdb6768 | ||
|
|
df89406987 | ||
|
|
7c355cef2d | ||
|
|
35536b5dbd | ||
|
|
0e69e4248c |
@@ -2952,6 +2952,15 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "cram42",
|
||||
"name": "Grant Le Roux",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5396871?v=4",
|
||||
"profile": "https://github.com/cram42",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -15,15 +15,13 @@ on:
|
||||
- develop
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
branches: .*
|
||||
|
||||
pipeline:
|
||||
- name: Setup
|
||||
cmd: |
|
||||
cp -v .env.example .env
|
||||
|
||||
cp -v .env.testing.example .env
|
||||
cp -v .env.testing.example .env.testing
|
||||
composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Generate Key
|
||||
@@ -36,15 +34,15 @@ pipeline:
|
||||
|
||||
- name: Run Migrations
|
||||
cmd: |
|
||||
# php artisan migrate --force
|
||||
php artisan migrate --force
|
||||
|
||||
- name: PHPUnit Unit Tests
|
||||
cmd: |
|
||||
# php artisan test --testsuite Unit
|
||||
php artisan test --testsuite Unit
|
||||
|
||||
- name: PHPUnit Feature Tests
|
||||
cmd: |
|
||||
# php artisan test --testsuite Feature
|
||||
php artisan test --testsuite Feature
|
||||
|
||||
# - name: Browser Tests
|
||||
# cmd: |
|
||||
|
||||
@@ -85,6 +85,7 @@ COOKIE_NAME=snipeit_session
|
||||
COOKIE_DOMAIN=null
|
||||
SECURE_COOKIES=false
|
||||
API_TOKEN_EXPIRATION_YEARS=15
|
||||
BS_TABLE_STORAGE=cookieStorage
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: SECURITY HEADER SETTINGS
|
||||
@@ -148,6 +149,7 @@ AWS_DEFAULT_REGION=null
|
||||
# --------------------------------------------
|
||||
LOGIN_MAX_ATTEMPTS=5
|
||||
LOGIN_LOCKOUT_DURATION=60
|
||||
LOGIN_AUTOCOMPLETE=false
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: FORGOTTEN PASSWORD SETTINGS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
 [](https://crowdin.com/project/snipe-it) [](https://hub.docker.com/r/snipe/snipe-it/) [](https://twitter.com/snipeitapp) [](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade)
|
||||
[](#contributors) [](https://discord.gg/yZFtShAcKk) [](https://huntr.dev)
|
||||
[](#contributors) [](https://discord.gg/yZFtShAcKk) [](https://huntr.dev)
|
||||
|
||||
## Snipe-IT - Open Source Asset Management System
|
||||
|
||||
@@ -145,7 +145,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
|
||||
| [<img src="https://avatars.githubusercontent.com/u/28321?v=4" width="110px;"/><br /><sub>Chris Hartjes</sub>](http://www.littlehart.net/atthekeyboard)<br />[💻](https://github.com/snipe/snipe-it/commits?author=chartjes "Code") | [<img src="https://avatars.githubusercontent.com/u/2404584?v=4" width="110px;"/><br /><sub>geo-chen</sub>](https://github.com/geo-chen)<br />[💻](https://github.com/snipe/snipe-it/commits?author=geo-chen "Code") | [<img src="https://avatars.githubusercontent.com/u/6006620?v=4" width="110px;"/><br /><sub>Phan Nguyen</sub>](https://github.com/nh314)<br />[💻](https://github.com/snipe/snipe-it/commits?author=nh314 "Code") | [<img src="https://avatars.githubusercontent.com/u/115993812?v=4" width="110px;"/><br /><sub>Iisakki Jaakkola</sub>](https://github.com/StarlessNights)<br />[💻](https://github.com/snipe/snipe-it/commits?author=StarlessNights "Code") | [<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="110px;"/><br /><sub>Ikko Ashimine</sub>](https://bandism.net/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=eltociear "Code") | [<img src="https://avatars.githubusercontent.com/u/56871540?v=4" width="110px;"/><br /><sub>Lukas Fehling</sub>](https://github.com/lukasfehling)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lukasfehling "Code") | [<img src="https://avatars.githubusercontent.com/u/1975990?v=4" width="110px;"/><br /><sub>Fernando Almeida</sub>](https://github.com/fernando-almeida)<br />[💻](https://github.com/snipe/snipe-it/commits?author=fernando-almeida "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/116301219?v=4" width="110px;"/><br /><sub>akemidx</sub>](https://github.com/akemidx)<br />[💻](https://github.com/snipe/snipe-it/commits?author=akemidx "Code") | [<img src="https://avatars.githubusercontent.com/u/144778?v=4" width="110px;"/><br /><sub>Oguz Bilgic</sub>](http://oguz.site)<br />[💻](https://github.com/snipe/snipe-it/commits?author=oguzbilgic "Code") | [<img src="https://avatars.githubusercontent.com/u/9262438?v=4" width="110px;"/><br /><sub>Scooter Crawford</sub>](https://github.com/scoo73r)<br />[💻](https://github.com/snipe/snipe-it/commits?author=scoo73r "Code") | [<img src="https://avatars.githubusercontent.com/u/5957345?v=4" width="110px;"/><br /><sub>subdriven</sub>](https://github.com/subdriven)<br />[💻](https://github.com/snipe/snipe-it/commits?author=subdriven "Code") | [<img src="https://avatars.githubusercontent.com/u/658865?v=4" width="110px;"/><br /><sub>Andrew Savinykh</sub>](https://github.com/AndrewSav)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AndrewSav "Code") | [<img src="https://avatars.githubusercontent.com/u/1155067?v=4" width="110px;"/><br /><sub>Tadayuki Onishi</sub>](https://kenchan0130.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=kenchan0130 "Code") | [<img src="https://avatars.githubusercontent.com/u/112496896?v=4" width="110px;"/><br /><sub>Florian</sub>](https://github.com/floschoepfer)<br />[💻](https://github.com/snipe/snipe-it/commits?author=floschoepfer "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/7305753?v=4" width="110px;"/><br /><sub>Spencer Long</sub>](http://spencerlong.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=spencerrlongg "Code") | [<img src="https://avatars.githubusercontent.com/u/1141514?v=4" width="110px;"/><br /><sub>Marcus Moore</sub>](https://github.com/marcusmoore)<br />[💻](https://github.com/snipe/snipe-it/commits?author=marcusmoore "Code") | [<img src="https://avatars.githubusercontent.com/u/570639?v=4" width="110px;"/><br /><sub>Martin Meredith</sub>](https://github.com/Mezzle)<br /> | [<img src="https://avatars.githubusercontent.com/u/5731963?v=4" width="110px;"/><br /><sub>dboth</sub>](http://dboth.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dboth "Code") | [<img src="https://avatars.githubusercontent.com/u/87536651?v=4" width="110px;"/><br /><sub>Zachary Fleck</sub>](https://github.com/zacharyfleck)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zacharyfleck "Code") | [<img src="https://avatars.githubusercontent.com/u/74609912?v=4" width="110px;"/><br /><sub>VIKAAS-A</sub>](https://github.com/vikaas-cyper)<br />[💻](https://github.com/snipe/snipe-it/commits?author=vikaas-cyper "Code") | [<img src="https://avatars.githubusercontent.com/u/88882041?v=4" width="110px;"/><br /><sub>Abdul Kareem</sub>](https://github.com/ak-piracha)<br />[💻](https://github.com/snipe/snipe-it/commits?author=ak-piracha "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/111287779?v=4" width="110px;"/><br /><sub>NojoudAlshehri</sub>](https://github.com/NojoudAlshehri)<br />[💻](https://github.com/snipe/snipe-it/commits?author=NojoudAlshehri "Code") | [<img src="https://avatars.githubusercontent.com/u/54367449?v=4" width="110px;"/><br /><sub>Stefan Stidl</sub>](https://github.com/stefanstidlffg)<br />[💻](https://github.com/snipe/snipe-it/commits?author=stefanstidlffg "Code") | [<img src="https://avatars.githubusercontent.com/u/87803479?v=4" width="110px;"/><br /><sub>Quentin Aymard</sub>](https://github.com/qay21)<br />[💻](https://github.com/snipe/snipe-it/commits?author=qay21 "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/111287779?v=4" width="110px;"/><br /><sub>NojoudAlshehri</sub>](https://github.com/NojoudAlshehri)<br />[💻](https://github.com/snipe/snipe-it/commits?author=NojoudAlshehri "Code") | [<img src="https://avatars.githubusercontent.com/u/54367449?v=4" width="110px;"/><br /><sub>Stefan Stidl</sub>](https://github.com/stefanstidlffg)<br />[💻](https://github.com/snipe/snipe-it/commits?author=stefanstidlffg "Code") | [<img src="https://avatars.githubusercontent.com/u/87803479?v=4" width="110px;"/><br /><sub>Quentin Aymard</sub>](https://github.com/qay21)<br />[💻](https://github.com/snipe/snipe-it/commits?author=qay21 "Code") | [<img src="https://avatars.githubusercontent.com/u/5396871?v=4" width="110px;"/><br /><sub>Grant Le Roux</sub>](https://github.com/cram42)<br />[💻](https://github.com/snipe/snipe-it/commits?author=cram42 "Code") |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
||||
@@ -212,9 +212,12 @@ class LdapSync extends Command
|
||||
$item['manager'] = $results[$i][$ldap_result_manager][0] ?? '';
|
||||
$item['location'] = $results[$i][$ldap_result_location][0] ?? '';
|
||||
|
||||
$location = Location::firstOrCreate([
|
||||
'name' => $item['location'],
|
||||
]);
|
||||
// ONLY if you are using the "ldap_location" option *AND* you have an actual result
|
||||
if ($ldap_result_location && $item['location']) {
|
||||
$location = Location::firstOrCreate([
|
||||
'name' => $item['location'],
|
||||
]);
|
||||
}
|
||||
$department = Department::firstOrCreate([
|
||||
'name' => $item['department'],
|
||||
]);
|
||||
@@ -231,17 +234,39 @@ class LdapSync extends Command
|
||||
$item['createorupdate'] = 'created';
|
||||
}
|
||||
|
||||
$user->first_name = $item['firstname'];
|
||||
$user->last_name = $item['lastname'];
|
||||
//If a sync option is not filled in on the LDAP settings don't populate the user field
|
||||
if($ldap_result_username != null){
|
||||
$user->username = $item['username'];
|
||||
$user->email = $item['email'];
|
||||
}
|
||||
if($ldap_result_last_name != null){
|
||||
$user->last_name = $item['lastname'];
|
||||
}
|
||||
if($ldap_result_first_name != null){
|
||||
$user->first_name = $item['firstname'];
|
||||
}
|
||||
if($ldap_result_emp_num != null){
|
||||
$user->employee_num = e($item['employee_number']);
|
||||
}
|
||||
if($ldap_result_email != null){
|
||||
$user->email = $item['email'];
|
||||
}
|
||||
if($ldap_result_phone != null){
|
||||
$user->phone = $item['telephone'];
|
||||
}
|
||||
if($ldap_result_jobtitle != null){
|
||||
$user->jobtitle = $item['jobtitle'];
|
||||
}
|
||||
if($ldap_result_country != null){
|
||||
$user->country = $item['country'];
|
||||
}
|
||||
if($ldap_result_dept != null){
|
||||
$user->department_id = $department->id;
|
||||
$user->location_id = $location->id;
|
||||
}
|
||||
if($ldap_result_location != null){
|
||||
$user->location_id = $location ? $location->id : null;
|
||||
}
|
||||
|
||||
if($ldap_result_manager != null){
|
||||
if($item['manager'] != null) {
|
||||
// Check Cache first
|
||||
if (isset($manager_cache[$item['manager']])) {
|
||||
@@ -281,6 +306,7 @@ class LdapSync extends Command
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sync activated state for Active Directory.
|
||||
if ( !empty($ldap_result_active_flag)) { // IF we have an 'active' flag set....
|
||||
|
||||
@@ -33,6 +33,16 @@ class Helper
|
||||
}
|
||||
}
|
||||
|
||||
public static function parseEscapedMarkedownInline($str = null)
|
||||
{
|
||||
$Parsedown = new \Parsedown();
|
||||
$Parsedown->setSafeMode(true);
|
||||
|
||||
if ($str) {
|
||||
return $Parsedown->line($str);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The importer has formatted number strings since v3,
|
||||
* so the value might be a string, or an integer.
|
||||
@@ -543,8 +553,8 @@ class Helper
|
||||
'license' => trans('general.license'),
|
||||
];
|
||||
|
||||
if($selection != null){
|
||||
return $category_types[$selection];
|
||||
if ($selection != null){
|
||||
return $category_types[strtolower($selection)];
|
||||
}
|
||||
else
|
||||
return $category_types;
|
||||
@@ -1210,10 +1220,60 @@ class Helper
|
||||
return true;
|
||||
\Log::debug('app locked!');
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Conversion between units of measurement
|
||||
*
|
||||
* @author Grant Le Roux <grant.leroux+snipe-it@gmail.com>
|
||||
* @since 5.0
|
||||
* @param float $value Measurement value to convert
|
||||
* @param string $srcUnit Source unit of measurement
|
||||
* @param string $dstUnit Destination unit of measurement
|
||||
* @param int $round Round the result to decimals (Default false - No rounding)
|
||||
* @return float
|
||||
*/
|
||||
public static function convertUnit($value, $srcUnit, $dstUnit, $round=false) {
|
||||
$srcFactor = static::getUnitConversionFactor($srcUnit);
|
||||
$dstFactor = static::getUnitConversionFactor($dstUnit);
|
||||
$output = $value * $srcFactor / $dstFactor;
|
||||
return ($round !== false) ? round($output, $round) : $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get conversion factor from unit of measurement to mm
|
||||
*
|
||||
* @author Grant Le Roux <grant.leroux+snipe-it@gmail.com>
|
||||
* @since 5.0
|
||||
* @param string $unit Unit of measurement
|
||||
* @return float
|
||||
*/
|
||||
public static function getUnitConversionFactor($unit) {
|
||||
switch (strtolower($unit)) {
|
||||
case 'mm':
|
||||
return 1.0;
|
||||
case 'cm':
|
||||
return 10.0;
|
||||
case 'm':
|
||||
return 1000.0;
|
||||
case 'in':
|
||||
return 25.4;
|
||||
case 'ft':
|
||||
return 12 * static::getUnitConversionFactor('in');
|
||||
case 'yd':
|
||||
return 3 * static::getUnitConversionFactor('ft');
|
||||
case 'pt':
|
||||
return (1 / 72) * static::getUnitConversionFactor('in');
|
||||
default:
|
||||
throw new \InvalidArgumentException('Unit: \'' . $unit . '\' is not supported');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* I know it's gauche to return a shitty HTML string, but this is just a helper and since it will be the same every single time,
|
||||
|
||||
@@ -126,12 +126,13 @@ class AccessoriesController extends Controller
|
||||
public function getClone($accessoryId = null)
|
||||
{
|
||||
|
||||
$this->authorize('create', Accesory::class);
|
||||
$this->authorize('create', Accessory::class);
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($accessory_to_clone = Accessory::find($accessoryId))) {
|
||||
// Redirect to the asset management page
|
||||
return redirect()->route('accessory.index')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
return redirect()->route('accessories.index')
|
||||
->with('error', trans('admin/accessories/message.does_not_exist', ['id' => $accessoryId]));
|
||||
}
|
||||
|
||||
$accessory = clone $accessory_to_clone;
|
||||
|
||||
@@ -331,7 +331,7 @@ class AccessoriesController extends Controller
|
||||
$accessory = Accessory::find($accessory_user->accessory_id);
|
||||
$this->authorize('checkin', $accessory);
|
||||
|
||||
$logaction = $accessory->logCheckin(User::find($accessory_user->user_id), $request->input('note'));
|
||||
$logaction = $accessory->logCheckin(User::find($accessory_user->assigned_to), $request->input('note'));
|
||||
|
||||
// Was the accessory updated?
|
||||
if (DB::table('accessories_users')->where('id', '=', $accessory_user->id)->delete()) {
|
||||
|
||||
@@ -545,7 +545,8 @@ class AssetsController extends Controller
|
||||
$asset->model_id = $request->get('model_id');
|
||||
$asset->order_number = $request->get('order_number');
|
||||
$asset->notes = $request->get('notes');
|
||||
$asset->asset_tag = $request->get('asset_tag', Asset::autoincrement_asset());
|
||||
$asset->asset_tag = $request->get('asset_tag', Asset::autoincrement_asset()); //yup, problem :/
|
||||
// NO IT IS NOT!!! This is never firing; we SHOW the asset_tag you're going to get, so it *will* be filled in!
|
||||
$asset->user_id = Auth::id();
|
||||
$asset->archived = '0';
|
||||
$asset->physical = '1';
|
||||
|
||||
@@ -27,6 +27,9 @@ class CompaniesController extends Controller
|
||||
$allowed_columns = [
|
||||
'id',
|
||||
'name',
|
||||
'phone',
|
||||
'fax',
|
||||
'email',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'users_count',
|
||||
@@ -47,6 +50,10 @@ class CompaniesController extends Controller
|
||||
$companies->where('name', '=', $request->input('name'));
|
||||
}
|
||||
|
||||
if ($request->filled('email')) {
|
||||
$companies->where('email', '=', $request->input('email'));
|
||||
}
|
||||
|
||||
|
||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||
$offset = ($request->input('offset') > $companies->count()) ? $companies->count() : abs($request->input('offset'));
|
||||
@@ -166,6 +173,7 @@ class CompaniesController extends Controller
|
||||
$companies = Company::select([
|
||||
'companies.id',
|
||||
'companies.name',
|
||||
'companies.email',
|
||||
'companies.image',
|
||||
]);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Events\CheckoutableCheckedIn;
|
||||
use App\Events\ComponentCheckedIn;
|
||||
use App\Models\Asset;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
|
||||
class ComponentsController extends Controller
|
||||
{
|
||||
@@ -203,12 +204,29 @@ class ComponentsController extends Controller
|
||||
$this->authorize('view', \App\Models\Asset::class);
|
||||
|
||||
$component = Component::findOrFail($id);
|
||||
$assets = $component->assets();
|
||||
|
||||
|
||||
$offset = request('offset', 0);
|
||||
$limit = $request->input('limit', 50);
|
||||
$total = $assets->count();
|
||||
$assets = $assets->skip($offset)->take($limit)->get();
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$assets = $component->assets()
|
||||
->where(function ($query) use ($request) {
|
||||
$search_str = '%' . $request->input('search') . '%';
|
||||
$query->where('name', 'like', $search_str)
|
||||
->orWhereIn('model_id', function (Builder $query) use ($request) {
|
||||
$search_str = '%' . $request->input('search') . '%';
|
||||
$query->selectRaw('id')->from('models')->where('name', 'like', $search_str);
|
||||
})
|
||||
->orWhere('asset_tag', 'like', $search_str);
|
||||
})
|
||||
->get();
|
||||
$total = $assets->count();
|
||||
} else {
|
||||
$assets = $component->assets();
|
||||
|
||||
$total = $assets->count();
|
||||
$assets = $assets->skip($offset)->take($limit)->get();
|
||||
}
|
||||
|
||||
return (new ComponentsTransformer)->transformCheckedoutComponents($assets, $total);
|
||||
}
|
||||
@@ -235,7 +253,7 @@ class ComponentsController extends Controller
|
||||
$this->authorize('checkout', $component);
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'asset_id' => 'required|exists:assets,id',
|
||||
'assigned_to' => 'required|exists:assets,id',
|
||||
'assigned_qty' => "required|numeric|min:1|digits_between:1,".$component->numRemaining(),
|
||||
]);
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ class DepartmentsController extends Controller
|
||||
$departments = Company::scopeCompanyables(Department::select(
|
||||
'departments.id',
|
||||
'departments.name',
|
||||
'departments.phone',
|
||||
'departments.fax',
|
||||
'departments.location_id',
|
||||
'departments.company_id',
|
||||
'departments.manager_id',
|
||||
|
||||
71
app/Http/Controllers/Api/LabelsController.php
Normal file
71
app/Http/Controllers/Api/LabelsController.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Transformers\LabelsTransformer;
|
||||
use App\Models\Labels\Label;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\ItemNotFoundException;
|
||||
use Auth;
|
||||
|
||||
class LabelsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Returns JSON listing of all labels.
|
||||
*
|
||||
* @author Grant Le Roux <grant.leroux+snipe-it@gmail.com>
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->authorize('view', Label::class);
|
||||
|
||||
$labels = Label::find();
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->get('search');
|
||||
$labels = $labels->filter(function ($label, $index) use ($search) {
|
||||
return stripos($label->getName(), $search) !== false;
|
||||
});
|
||||
}
|
||||
|
||||
$total = $labels->count();
|
||||
|
||||
$offset = $request->get('offset', 0);
|
||||
$offset = ($offset > $total) ? $total : $offset;
|
||||
|
||||
$maxLimit = config('app.max_results');
|
||||
$limit = $request->get('limit', $maxLimit);
|
||||
$limit = ($limit > $maxLimit) ? $maxLimit : $limit;
|
||||
|
||||
$labels = $labels->skip($offset)->take($limit);
|
||||
|
||||
return (new LabelsTransformer)->transformLabels($labels, $total, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns JSON with information about a label for detail view.
|
||||
*
|
||||
* @author Grant Le Roux <grant.leroux+snipe-it@gmail.com>
|
||||
* @param string $labelName
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function show(string $labelName)
|
||||
{
|
||||
$labelName = str_replace('/', '\\', $labelName);
|
||||
try {
|
||||
$label = Label::find($labelName);
|
||||
} catch(ItemNotFoundException $e) {
|
||||
return response()
|
||||
->json(
|
||||
Helper::formatStandardApiResponse('error', null, trans('admin/labels/message.does_not_exist')),
|
||||
404
|
||||
);
|
||||
}
|
||||
$this->authorize('view', $label);
|
||||
return (new LabelsTransformer)->transformLabel($label);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,11 @@ class LicenseSeatsController extends Controller
|
||||
|
||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||
$offset = ($request->input('offset') > $seats->count()) ? $seats->count() : abs($request->input('offset'));
|
||||
|
||||
if ($offset >= $total ){
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
$limit = app('api_limit_value');
|
||||
|
||||
$seats = $seats->skip($offset)->take($limit)->get();
|
||||
|
||||
@@ -37,6 +37,8 @@ class LocationsController extends Controller
|
||||
'locations.city',
|
||||
'locations.state',
|
||||
'locations.zip',
|
||||
'locations.phone',
|
||||
'locations.fax',
|
||||
'locations.country',
|
||||
'locations.parent_id',
|
||||
'locations.manager_id',
|
||||
@@ -251,8 +253,12 @@ class LocationsController extends Controller
|
||||
*/
|
||||
public function selectlist(Request $request)
|
||||
{
|
||||
|
||||
$this->authorize('view.selectlists');
|
||||
// If a user is in the process of editing their profile, as determined by the referrer,
|
||||
// then we check that they have permission to edit their own location.
|
||||
// Otherwise, we do our normal check that they can view select lists.
|
||||
$request->headers->get('referer') === route('profile')
|
||||
? $this->authorize('self.edit_location')
|
||||
: $this->authorize('view.selectlists');
|
||||
|
||||
$locations = Location::select([
|
||||
'locations.id',
|
||||
|
||||
@@ -41,7 +41,7 @@ class SuppliersController extends Controller
|
||||
];
|
||||
|
||||
$suppliers = Supplier::select(
|
||||
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'updated_at', 'deleted_at', 'image', 'notes'])
|
||||
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'updated_at', 'deleted_at', 'image', 'notes', 'url'])
|
||||
->withCount('assets as assets_count')
|
||||
->withCount('licenses as licenses_count')
|
||||
->withCount('accessories as accessories_count')
|
||||
|
||||
@@ -78,12 +78,6 @@ class UsersController extends Controller
|
||||
$users = Company::scopeCompanyables($users);
|
||||
|
||||
|
||||
if (($request->filled('deleted')) && ($request->input('deleted') == 'true')) {
|
||||
$users = $users->onlyTrashed();
|
||||
} elseif (($request->filled('all')) && ($request->input('all') == 'true')) {
|
||||
$users = $users->withTrashed();
|
||||
}
|
||||
|
||||
if ($request->filled('activated')) {
|
||||
$users = $users->where('users.activated', '=', $request->input('activated'));
|
||||
}
|
||||
@@ -272,6 +266,12 @@ class UsersController extends Controller
|
||||
break;
|
||||
}
|
||||
|
||||
if (($request->filled('deleted')) && ($request->input('deleted') == 'true')) {
|
||||
$users = $users->onlyTrashed();
|
||||
} elseif (($request->filled('all')) && ($request->input('all') == 'true')) {
|
||||
$users = $users->withTrashed();
|
||||
}
|
||||
|
||||
$total = $users->count();
|
||||
$users = $users->skip($offset)->take($limit)->get();
|
||||
|
||||
|
||||
@@ -94,14 +94,18 @@ class AssetCheckinController extends Controller
|
||||
\Log::debug('Manually override the location IDs');
|
||||
\Log::debug('Original Location ID: '.$asset->location_id);
|
||||
$asset->location_id = '';
|
||||
\Log::debug('New RTD Location ID: '.$asset->location_id);
|
||||
\Log::debug('New Location ID: '.$asset->location_id);
|
||||
}
|
||||
|
||||
$asset->location_id = $asset->rtd_location_id;
|
||||
|
||||
if ($request->filled('location_id')) {
|
||||
\Log::debug('NEW Location ID: '.$request->get('location_id'));
|
||||
$asset->location_id = e($request->get('location_id'));
|
||||
$asset->location_id = $request->get('location_id');
|
||||
|
||||
if ($request->get('update_default_location') == 0){
|
||||
$asset->rtd_location_id = $request->get('location_id');
|
||||
}
|
||||
}
|
||||
|
||||
$checkin_at = date('Y-m-d H:i:s');
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Models\Location;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\User;
|
||||
use App\View\Label;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
@@ -453,11 +454,12 @@ class AssetsController extends Controller
|
||||
* @since [v3.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function getAssetByTag(Request $request)
|
||||
public function getAssetByTag(Request $request, $tag=null)
|
||||
{
|
||||
$tag = $tag ? $tag : $request->get('assetTag');
|
||||
$topsearch = ($request->get('topsearch') == 'true');
|
||||
|
||||
if (! $asset = Asset::where('asset_tag', '=', $request->get('assetTag'))->first()) {
|
||||
if (! $asset = Asset::where('asset_tag', '=', $tag)->first()) {
|
||||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
$this->authorize('view', $asset);
|
||||
@@ -554,9 +556,11 @@ class AssetsController extends Controller
|
||||
$asset = Asset::find($assetId);
|
||||
$this->authorize('view', $asset);
|
||||
|
||||
return view('hardware/labels')
|
||||
->with('assets', Asset::find($asset))
|
||||
return (new Label())
|
||||
->with('assets', collect([ $asset ]))
|
||||
->with('settings', Setting::getSettings())
|
||||
->with('template', request()->get('template'))
|
||||
->with('offset', request()->get('offset'))
|
||||
->with('bulkedit', false)
|
||||
->with('count', 0);
|
||||
}
|
||||
@@ -774,7 +778,7 @@ class AssetsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Retore a deleted asset.
|
||||
* Restore a deleted asset.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Http\Controllers\CheckInOutRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Asset;
|
||||
use App\Models\Setting;
|
||||
use App\View\Label;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -45,7 +46,7 @@ class BulkAssetsController extends Controller
|
||||
switch ($request->input('bulk_actions')) {
|
||||
case 'labels':
|
||||
$this->authorize('view', Asset::class);
|
||||
return view('hardware/labels')
|
||||
return (new Label)
|
||||
->with('assets', Asset::find($asset_ids))
|
||||
->with('settings', Setting::getSettings())
|
||||
->with('bulkedit', true)
|
||||
|
||||
@@ -60,6 +60,9 @@ final class CompaniesController extends Controller
|
||||
|
||||
$company = new Company;
|
||||
$company->name = $request->input('name');
|
||||
$company->phone = $request->input('phone');
|
||||
$company->fax = $request->input('fax');
|
||||
$company->email = $request->input('email');
|
||||
|
||||
$company = $request->handleImages($company);
|
||||
|
||||
@@ -111,6 +114,9 @@ final class CompaniesController extends Controller
|
||||
$this->authorize('update', $company);
|
||||
|
||||
$company->name = $request->input('name');
|
||||
$company->phone = $request->input('phone');
|
||||
$company->fax = $request->input('fax');
|
||||
$company->email = $request->input('email');
|
||||
|
||||
$company = $request->handleImages($company);
|
||||
|
||||
@@ -119,8 +125,7 @@ final class CompaniesController extends Controller
|
||||
->with('success', trans('admin/companies/message.update.success'));
|
||||
}
|
||||
|
||||
return redirect()->route('companies.edit', ['company' => $companyId])
|
||||
->with('error', trans('admin/companies/message.update.error'));
|
||||
return redirect()->back()->withInput()->withErrors($company->getErrors());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -109,6 +109,7 @@ class CustomFieldsController extends Controller
|
||||
"is_unique" => $request->get("is_unique", 0),
|
||||
"display_in_user_view" => $display_in_user_view,
|
||||
"auto_add_to_fieldsets" => $request->get("auto_add_to_fieldsets", 0),
|
||||
"show_in_listview" => $request->get("show_in_listview", 0),
|
||||
"user_id" => Auth::id()
|
||||
]);
|
||||
|
||||
@@ -265,6 +266,7 @@ class CustomFieldsController extends Controller
|
||||
$field->is_unique = $request->get("is_unique", 0);
|
||||
$field->display_in_user_view = $display_in_user_view;
|
||||
$field->auto_add_to_fieldsets = $request->get("auto_add_to_fieldsets", 0);
|
||||
$field->show_in_listview = $request->get("show_in_listview", 0);
|
||||
|
||||
if ($request->get('format') == 'CUSTOM REGEX') {
|
||||
$field->format = e($request->get('custom_format'));
|
||||
|
||||
@@ -94,7 +94,7 @@ class CustomFieldsetsController extends Controller
|
||||
$this->authorize('create', CustomField::class);
|
||||
|
||||
$fieldset = new CustomFieldset([
|
||||
'name' => e($request->get('name')),
|
||||
'name' => $request->get('name'),
|
||||
'user_id' => Auth::user()->id,
|
||||
]);
|
||||
|
||||
|
||||
@@ -170,6 +170,8 @@ class DepartmentsController extends Controller
|
||||
$department->manager_id = ($request->filled('manager_id') ? $request->input('manager_id') : null);
|
||||
$department->location_id = ($request->filled('location_id') ? $request->input('location_id') : null);
|
||||
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
|
||||
$department->phone = $request->input('phone');
|
||||
$department->fax = $request->input('fax');
|
||||
|
||||
$department = $request->handleImages($department);
|
||||
|
||||
|
||||
77
app/Http/Controllers/LabelsController.php
Executable file
77
app/Http/Controllers/LabelsController.php
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\Labels\Label;
|
||||
use App\Models\Manufacturer;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\View\Label as LabelView;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class LabelsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Returns the Label view with test data
|
||||
*
|
||||
* @author Grant Le Roux <grant.leroux+snipe-it@gmail.com>
|
||||
* @param string $labelName
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show(string $labelName)
|
||||
{
|
||||
$labelName = str_replace('/', '\\', $labelName);
|
||||
$template = Label::find($labelName);
|
||||
|
||||
$exampleAsset = new Asset();
|
||||
|
||||
$exampleAsset->id = 999999;
|
||||
$exampleAsset->name = 'AST-AB-CD-1234';
|
||||
$exampleAsset->asset_tag = 'TCA-00001';
|
||||
$exampleAsset->serial = 'SN9876543210';
|
||||
|
||||
$exampleAsset->company = new Company();
|
||||
$exampleAsset->company->id = 999999;
|
||||
$exampleAsset->company->name = 'Test Company Limited';
|
||||
$exampleAsset->company->image = 'company-image-test.png';
|
||||
|
||||
$exampleAsset->assignedto = new User();
|
||||
$exampleAsset->assignedto->id = 999999;
|
||||
$exampleAsset->assignedto->first_name = 'Test';
|
||||
$exampleAsset->assignedto->last_name = 'Person';
|
||||
$exampleAsset->assignedto->username = 'Test.Person';
|
||||
$exampleAsset->assignedto->employee_num = '0123456789';
|
||||
|
||||
$exampleAsset->model = new AssetModel();
|
||||
$exampleAsset->model->id = 999999;
|
||||
$exampleAsset->model->name = 'Test Model';
|
||||
$exampleAsset->model->model_number = 'MDL5678';
|
||||
$exampleAsset->model->manufacturer = new Manufacturer();
|
||||
$exampleAsset->model->manufacturer->id = 999999;
|
||||
$exampleAsset->model->manufacturer->name = 'Test Manufacturing Inc.';
|
||||
$exampleAsset->model->category = new Category();
|
||||
$exampleAsset->model->category->id = 999999;
|
||||
$exampleAsset->model->category->name = 'Test Category';
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
if (request()->has('settings')) {
|
||||
$overrides = request()->get('settings');
|
||||
foreach ($overrides as $key => $value) {
|
||||
$settings->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return (new LabelView())
|
||||
->with('assets', collect([$exampleAsset]))
|
||||
->with('settings', $settings)
|
||||
->with('template', $template)
|
||||
->with('bulkedit', false)
|
||||
->with('count', 0);
|
||||
|
||||
return redirect()->route('home')->with('error', trans('admin/labels/message.does_not_exist'));
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ class LicensesController extends Controller
|
||||
if ($license->assigned_seats_count == 0) {
|
||||
// Delete the license and the associated license seats
|
||||
DB::table('license_seats')
|
||||
->where('id', $license->id)
|
||||
->where('license_id', $license->id)
|
||||
->update(['assigned_to' => null, 'asset_id' => null]);
|
||||
|
||||
$licenseSeats = $license->licenseseats();
|
||||
|
||||
@@ -79,6 +79,8 @@ class LocationsController extends Controller
|
||||
$location->ldap_ou = $request->input('ldap_ou');
|
||||
$location->manager_id = $request->input('manager_id');
|
||||
$location->user_id = Auth::id();
|
||||
$location->phone = request('phone');
|
||||
$location->fax = request('fax');
|
||||
|
||||
$location = $request->handleImages($location);
|
||||
|
||||
@@ -139,6 +141,8 @@ class LocationsController extends Controller
|
||||
$location->state = $request->input('state');
|
||||
$location->country = $request->input('country');
|
||||
$location->zip = $request->input('zip');
|
||||
$location->phone = request('phone');
|
||||
$location->fax = request('fax');
|
||||
$location->ldap_ou = $request->input('ldap_ou');
|
||||
$location->manager_id = $request->input('manager_id');
|
||||
|
||||
|
||||
@@ -501,7 +501,6 @@ class ReportsController extends Controller
|
||||
$header[] = trans('general.zip');
|
||||
}
|
||||
|
||||
|
||||
if ($request->filled('assigned_to')) {
|
||||
$header[] = trans('admin/hardware/table.checkoutto');
|
||||
$header[] = trans('general.type');
|
||||
@@ -532,13 +531,14 @@ class ReportsController extends Controller
|
||||
}
|
||||
|
||||
if ($request->filled('warranty')) {
|
||||
$header[] = 'Warranty';
|
||||
$header[] = 'Warranty Expires';
|
||||
$header[] = trans('admin/hardware/form.warranty');
|
||||
$header[] = trans('admin/hardware/form.warranty_expires');
|
||||
}
|
||||
|
||||
if ($request->filled('depreciation')) {
|
||||
$header[] = 'Value';
|
||||
$header[] = 'Diff';
|
||||
$header[] = 'Fully Depreciated';
|
||||
$header[] = trans('admin/hardware/table.book_value');
|
||||
$header[] = trans('admin/hardware/table.diff');
|
||||
$header[] = trans('admin/hardware/form.fully_depreciated');
|
||||
}
|
||||
|
||||
if ($request->filled('checkout_date')) {
|
||||
@@ -590,7 +590,7 @@ class ReportsController extends Controller
|
||||
$executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
|
||||
\Log::debug('Added headers: '.$executionTime);
|
||||
|
||||
$assets = \App\Models\Company::scopeCompanyables(Asset::select('assets.*'))->with(
|
||||
$assets = Asset::select('assets.*')->with(
|
||||
'location', 'assetstatus', 'company', 'defaultLoc', 'assignedTo',
|
||||
'model.category', 'model.manufacturer', 'supplier');
|
||||
|
||||
@@ -639,10 +639,16 @@ class ReportsController extends Controller
|
||||
}
|
||||
|
||||
if (($request->filled('created_start')) && ($request->filled('created_end'))) {
|
||||
$assets->whereBetween('assets.created_at', [$request->input('created_start'), $request->input('created_end')]);
|
||||
$created_start = \Carbon::parse($request->input('created_start'))->startOfDay();
|
||||
$created_end = \Carbon::parse($request->input('created_end'))->endOfDay();
|
||||
|
||||
$assets->whereBetween('assets.created_at', [$created_start, $created_end]);
|
||||
}
|
||||
if (($request->filled('checkout_date_start')) && ($request->filled('checkout_date_end'))) {
|
||||
$assets->whereBetween('assets.last_checkout', [$request->input('checkout_date_start'), $request->input('checkout_date_end')]);
|
||||
$checkout_start = \Carbon::parse($request->input('checkout_date_start'))->startOfDay();
|
||||
$checkout_end = \Carbon::parse($request->input('checkout_date_end'))->endOfDay();
|
||||
|
||||
$assets->whereBetween('assets.last_checkout', [$checkout_start, $checkout_end]);
|
||||
}
|
||||
|
||||
if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) {
|
||||
@@ -650,7 +656,10 @@ class ReportsController extends Controller
|
||||
}
|
||||
|
||||
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
|
||||
$assets->whereBetween('assets.last_audit_date', [$request->input('last_audit_start'), $request->input('last_audit_end')]);
|
||||
$last_audit_start = \Carbon::parse($request->input('last_audit_start'))->startOfDay();
|
||||
$last_audit_end = \Carbon::parse($request->input('last_audit_end'))->endOfDay();
|
||||
|
||||
$assets->whereBetween('assets.last_audit_date', [$last_audit_start, $last_audit_end]);
|
||||
}
|
||||
|
||||
if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) {
|
||||
|
||||
@@ -827,6 +827,14 @@ class SettingsController extends Controller
|
||||
if (is_null($setting = Setting::getSettings())) {
|
||||
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
|
||||
}
|
||||
$setting->label2_enable = $request->input('label2_enable');
|
||||
$setting->label2_template = $request->input('label2_template');
|
||||
$setting->label2_title = $request->input('label2_title');
|
||||
$setting->label2_asset_logo = $request->input('label2_asset_logo');
|
||||
$setting->label2_1d_type = $request->input('label2_1d_type');
|
||||
$setting->label2_2d_type = $request->input('label2_2d_type');
|
||||
$setting->label2_2d_target = $request->input('label2_2d_target');
|
||||
$setting->label2_fields = $request->input('label2_fields');
|
||||
$setting->labels_per_page = $request->input('labels_per_page');
|
||||
$setting->labels_width = $request->input('labels_width');
|
||||
$setting->labels_height = $request->input('labels_height');
|
||||
@@ -875,7 +883,7 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
if ($setting->save()) {
|
||||
return redirect()->route('settings.index')
|
||||
return redirect()->route('settings.labels.index')
|
||||
->with('success', trans('admin/settings/message.update.success'));
|
||||
}
|
||||
|
||||
|
||||
67
app/Http/Livewire/CategoryEditForm.php
Normal file
67
app/Http/Livewire/CategoryEditForm.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class CategoryEditForm extends Component
|
||||
{
|
||||
public $defaultEulaText;
|
||||
|
||||
public $eulaText;
|
||||
|
||||
public $originalSendCheckInEmailValue;
|
||||
|
||||
public $requireAcceptance;
|
||||
|
||||
public $sendCheckInEmail;
|
||||
|
||||
public $useDefaultEula;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->originalSendCheckInEmailValue = $this->sendCheckInEmail;
|
||||
|
||||
if ($this->eulaText || $this->useDefaultEula) {
|
||||
$this->sendCheckInEmail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.category-edit-form');
|
||||
}
|
||||
|
||||
public function updated($property, $value)
|
||||
{
|
||||
if (! in_array($property, ['eulaText', 'useDefaultEula'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? 1 : $this->originalSendCheckInEmailValue;
|
||||
}
|
||||
|
||||
public function getShouldDisplayEmailMessageProperty(): bool
|
||||
{
|
||||
return $this->eulaText || $this->useDefaultEula;
|
||||
}
|
||||
|
||||
public function getEmailMessageProperty(): string
|
||||
{
|
||||
if ($this->useDefaultEula) {
|
||||
return trans('admin/categories/general.email_will_be_sent_due_to_global_eula');
|
||||
}
|
||||
|
||||
return trans('admin/categories/general.email_will_be_sent_due_to_category_eula');
|
||||
}
|
||||
|
||||
public function getEulaTextDisabledProperty()
|
||||
{
|
||||
return (bool)$this->useDefaultEula;
|
||||
}
|
||||
|
||||
public function getSendCheckInEmailDisabledProperty()
|
||||
{
|
||||
return $this->eulaText || $this->useDefaultEula;
|
||||
}
|
||||
}
|
||||
@@ -215,6 +215,7 @@ class Importer extends Component
|
||||
'manufacturer' => trans('general.manufacturer'),
|
||||
'order_number' => trans('general.order_number'),
|
||||
'image' => trans('general.importer.image_filename'),
|
||||
'asset_eol_date' => trans('admin/hardware/form.eol_date'),
|
||||
/**
|
||||
* Checkout fields:
|
||||
* Assets can be checked out to other assets, people, or locations, but we currently
|
||||
@@ -284,6 +285,9 @@ class Importer extends Component
|
||||
'maintained' => trans('admin/licenses/form.maintained'),
|
||||
'checkout_class' => trans('general.importer.checkout_type'),
|
||||
'serial' => trans('general.license_serial'),
|
||||
'email' => trans('general.importer.checked_out_to_email'),
|
||||
'username' => trans('general.importer.checked_out_to_username'),
|
||||
'manufacturer' => trans('general.manufacturer'),
|
||||
];
|
||||
|
||||
$this->users_fields = [
|
||||
@@ -313,7 +317,7 @@ class Importer extends Component
|
||||
'gravatar' => trans('general.importer.gravatar'),
|
||||
'start_date' => trans('general.start_date'),
|
||||
'end_date' => trans('general.end_date'),
|
||||
'employee_number' => trans('general.employee_number'),
|
||||
'employee_num' => trans('general.employee_number'),
|
||||
];
|
||||
|
||||
$this->locations_fields = [
|
||||
|
||||
@@ -32,7 +32,7 @@ class AccessoriesTransformer
|
||||
'model_number' => ($accessory->model_number) ? e($accessory->model_number) : null,
|
||||
'category' => ($accessory->category) ? ['id' => $accessory->category->id, 'name'=> e($accessory->category->name)] : null,
|
||||
'location' => ($accessory->location) ? ['id' => $accessory->location->id, 'name'=> e($accessory->location->name)] : null,
|
||||
'notes' => ($accessory->notes) ? Helper::parseEscapedMarkedown($accessory->notes) : null,
|
||||
'notes' => ($accessory->notes) ? Helper::parseEscapedMarkedownInline($accessory->notes) : null,
|
||||
'qty' => ($accessory->qty) ? (int) $accessory->qty : null,
|
||||
'purchase_date' => ($accessory->purchase_date) ? Helper::getFormattedDateObject($accessory->purchase_date, 'date') : null,
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($accessory->purchase_cost),
|
||||
|
||||
@@ -110,7 +110,7 @@ class ActionlogsTransformer
|
||||
'type' => e($actionlog->targetType()),
|
||||
] : null,
|
||||
|
||||
'note' => ($actionlog->note) ? Helper::parseEscapedMarkedown($actionlog->note): null,
|
||||
'note' => ($actionlog->note) ? Helper::parseEscapedMarkedownInline($actionlog->note): null,
|
||||
'signature_file' => ($actionlog->accept_signature) ? route('log.signature.view', ['filename' => $actionlog->accept_signature ]) : null,
|
||||
'log_meta' => ((isset($clean_meta)) && (is_array($clean_meta))) ? $clean_meta: null,
|
||||
'action_date' => ($actionlog->action_date) ? Helper::getFormattedDateObject($actionlog->action_date, 'datetime'): Helper::getFormattedDateObject($actionlog->created_at, 'datetime'),
|
||||
|
||||
@@ -49,7 +49,7 @@ class AssetMaintenancesTransformer
|
||||
'id' => (int) $assetmaintenance->asset->defaultLoc->id,
|
||||
'name'=> e($assetmaintenance->asset->defaultLoc->name),
|
||||
] : null,
|
||||
'notes' => ($assetmaintenance->notes) ? Helper::parseEscapedMarkedown($assetmaintenance->notes) : null,
|
||||
'notes' => ($assetmaintenance->notes) ? Helper::parseEscapedMarkedownInline($assetmaintenance->notes) : null,
|
||||
'supplier' => ($assetmaintenance->supplier) ? ['id' => $assetmaintenance->supplier->id, 'name'=> e($assetmaintenance->supplier->name)] : null,
|
||||
'cost' => Helper::formatCurrencyOutput($assetmaintenance->cost),
|
||||
'asset_maintenance_type' => e($assetmaintenance->asset_maintenance_type),
|
||||
|
||||
@@ -63,7 +63,7 @@ class AssetModelsTransformer
|
||||
'default_fieldset_values' => $default_field_values,
|
||||
'eol' => ($assetmodel->eol > 0) ? $assetmodel->eol.' months' : 'None',
|
||||
'requestable' => ($assetmodel->requestable == '1') ? true : false,
|
||||
'notes' => Helper::parseEscapedMarkedown($assetmodel->notes),
|
||||
'notes' => Helper::parseEscapedMarkedownInline($assetmodel->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($assetmodel->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($assetmodel->updated_at, 'datetime'),
|
||||
'deleted_at' => Helper::getFormattedDateObject($assetmodel->deleted_at, 'datetime'),
|
||||
|
||||
@@ -58,7 +58,7 @@ class AssetsTransformer
|
||||
'id' => (int) $asset->supplier->id,
|
||||
'name'=> e($asset->supplier->name),
|
||||
] : null,
|
||||
'notes' => ($asset->notes) ? Helper::parseEscapedMarkedown($asset->notes) : null,
|
||||
'notes' => ($asset->notes) ? Helper::parseEscapedMarkedownInline($asset->notes) : null,
|
||||
'order_number' => ($asset->order_number) ? e($asset->order_number) : null,
|
||||
'company' => ($asset->company) ? [
|
||||
'id' => (int) $asset->company->id,
|
||||
@@ -92,6 +92,7 @@ class AssetsTransformer
|
||||
'checkout_counter' => (int) $asset->checkout_counter,
|
||||
'requests_counter' => (int) $asset->requests_counter,
|
||||
'user_can_checkout' => (bool) $asset->availableForCheckout(),
|
||||
'book_value' => Helper::formatCurrencyOutput($asset->getLinearDepreciatedValue()),
|
||||
];
|
||||
|
||||
|
||||
@@ -101,10 +102,10 @@ class AssetsTransformer
|
||||
foreach ($asset->model->fieldset->fields as $field) {
|
||||
if ($field->isFieldDecryptable($asset->{$field->db_column})) {
|
||||
$decrypted = Helper::gracefulDecrypt($field, $asset->{$field->db_column});
|
||||
$value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||
$value = (Gate::allows('assets.view.encrypted_custom_fields')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||
|
||||
if ($field->format == 'DATE'){
|
||||
if (Gate::allows('superadmin')){
|
||||
if (Gate::allows('assets.view.encrypted_custom_fields')){
|
||||
$value = Helper::getFormattedDateObject($value, 'date', false);
|
||||
} else {
|
||||
$value = strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||
|
||||
@@ -26,6 +26,9 @@ class CompaniesTransformer
|
||||
$array = [
|
||||
'id' => (int) $company->id,
|
||||
'name' => e($company->name),
|
||||
'phone' => ($company->phone!='') ? e($company->phone): null,
|
||||
'fax' => ($company->fax!='') ? e($company->fax): null,
|
||||
'email' => ($company->email!='') ? e($company->email): null,
|
||||
'image' => ($company->image) ? Storage::disk('public')->url('companies/'.e($company->image)) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($company->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($company->updated_at, 'datetime'),
|
||||
|
||||
@@ -46,7 +46,7 @@ class ComponentsTransformer
|
||||
'id' => (int) $component->company->id,
|
||||
'name' => e($component->company->name),
|
||||
] : null,
|
||||
'notes' => ($component->notes) ? Helper::parseEscapedMarkedown($component->notes) : null,
|
||||
'notes' => ($component->notes) ? Helper::parseEscapedMarkedownInline($component->notes) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($component->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($component->updated_at, 'datetime'),
|
||||
'user_can_checkout' => ($component->numRemaining() > 0) ? 1 : 0,
|
||||
|
||||
@@ -39,7 +39,7 @@ class ConsumablesTransformer
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost),
|
||||
'purchase_date' => Helper::getFormattedDateObject($consumable->purchase_date, 'date'),
|
||||
'qty' => (int) $consumable->qty,
|
||||
'notes' => ($consumable->notes) ? Helper::parseEscapedMarkedown($consumable->notes) : null,
|
||||
'notes' => ($consumable->notes) ? Helper::parseEscapedMarkedownInline($consumable->notes) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($consumable->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($consumable->updated_at, 'datetime'),
|
||||
];
|
||||
|
||||
@@ -49,6 +49,7 @@ class CustomFieldsTransformer
|
||||
'required' => (($field->pivot) && ($field->pivot->required=='1')) ? true : false,
|
||||
'display_in_user_view' => ($field->display_in_user_view =='1') ? true : false,
|
||||
'auto_add_to_fieldsets' => ($field->auto_add_to_fieldsets == '1') ? true : false,
|
||||
'show_in_listview' => ($field->show_in_listview == '1') ? true : false,
|
||||
'created_at' => Helper::getFormattedDateObject($field->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($field->updated_at, 'datetime'),
|
||||
];
|
||||
|
||||
@@ -26,6 +26,8 @@ class DepartmentsTransformer
|
||||
$array = [
|
||||
'id' => (int) $department->id,
|
||||
'name' => e($department->name),
|
||||
'phone' => ($department->phone!='') ? e($department->phone): null,
|
||||
'fax' => ($department->fax!='') ? e($department->fax): null,
|
||||
'image' => ($department->image) ? Storage::disk('public')->url(app('departments_upload_url').e($department->image)) : null,
|
||||
'company' => ($department->company) ? [
|
||||
'id' => (int) $department->company->id,
|
||||
|
||||
71
app/Http/Transformers/LabelsTransformer.php
Normal file
71
app/Http/Transformers/LabelsTransformer.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Transformers;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\Label;
|
||||
use App\Models\Labels\Sheet;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class LabelsTransformer
|
||||
{
|
||||
public function transformLabels(Collection $labels, $total)
|
||||
{
|
||||
$array = [];
|
||||
foreach ($labels as $label) {
|
||||
$array[] = self::transformLabel($label);
|
||||
}
|
||||
|
||||
return (new DatatablesTransformer)->transformDatatables($array, $total);
|
||||
}
|
||||
|
||||
public function transformLabel(Label $label)
|
||||
{
|
||||
$array = [
|
||||
'name' => $label->getName(),
|
||||
'unit' => $label->getUnit(),
|
||||
|
||||
'width' => $label->getWidth(),
|
||||
'height' => $label->getHeight(),
|
||||
|
||||
'margin_top' => $label->getMarginTop(),
|
||||
'margin_bottom' => $label->getMarginBottom(),
|
||||
'margin_left' => $label->getMarginLeft(),
|
||||
'margin_right' => $label->getMarginRight(),
|
||||
|
||||
'support_asset_tag' => $label->getSupportAssetTag(),
|
||||
'support_1d_barcode' => $label->getSupport1DBarcode(),
|
||||
'support_2d_barcode' => $label->getSupport2DBarcode(),
|
||||
'support_fields' => $label->getSupportFields(),
|
||||
'support_logo' => $label->getSupportLogo(),
|
||||
'support_title' => $label->getSupportTitle(),
|
||||
];
|
||||
|
||||
if ($label instanceof Sheet) {
|
||||
$array['sheet_info'] = [
|
||||
'label_width' => $label->getLabelWidth(),
|
||||
'label_height' => $label->getLabelHeight(),
|
||||
|
||||
'label_margin_top' => $label->getLabelMarginTop(),
|
||||
'label_margin_bottom' => $label->getLabelMarginBottom(),
|
||||
'label_margin_left' => $label->getLabelMarginLeft(),
|
||||
'label_margin_right' => $label->getLabelMarginRight(),
|
||||
|
||||
'labels_per_page' => $label->getLabelsPerPage(),
|
||||
'label_border' => $label->getLabelBorder(),
|
||||
];
|
||||
}
|
||||
|
||||
if ($label instanceof RectangleSheet) {
|
||||
$array['rectanglesheet_info'] = [
|
||||
'columns' => $label->getColumns(),
|
||||
'rows' => $label->getRows(),
|
||||
'column_spacing' => $label->getLabelColumnSpacing(),
|
||||
'row_spacing' => $label->getLabelRowSpacing(),
|
||||
];
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class LicensesTransformer
|
||||
'depreciation' => ($license->depreciation) ? ['id' => (int) $license->depreciation->id,'name'=> e($license->depreciation->name)] : null,
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($license->purchase_cost),
|
||||
'purchase_cost_numeric' => $license->purchase_cost,
|
||||
'notes' => Helper::parseEscapedMarkedown($license->notes),
|
||||
'notes' => Helper::parseEscapedMarkedownInline($license->notes),
|
||||
'expiration_date' => Helper::getFormattedDateObject($license->expiration_date, 'date'),
|
||||
'seats' => (int) $license->seats,
|
||||
'free_seats_count' => (int) $license->free_seats_count,
|
||||
|
||||
@@ -43,6 +43,8 @@ class LocationsTransformer
|
||||
'state' => ($location->state) ? e($location->state) : null,
|
||||
'country' => ($location->country) ? e($location->country) : null,
|
||||
'zip' => ($location->zip) ? e($location->zip) : null,
|
||||
'phone' => ($location->phone!='') ? e($location->phone): null,
|
||||
'fax' => ($location->fax!='') ? e($location->fax): null,
|
||||
'assigned_assets_count' => (int) $location->assigned_assets_count,
|
||||
'assets_count' => (int) $location->assets_count,
|
||||
'rtd_assets_count' => (int) $location->rtd_assets_count,
|
||||
|
||||
@@ -43,7 +43,7 @@ class SuppliersTransformer
|
||||
'licenses_count' => (int) $supplier->licenses_count,
|
||||
'consumables_count' => (int) $supplier->consumables_count,
|
||||
'components_count' => (int) $supplier->components_count,
|
||||
'notes' => ($supplier->notes) ? Helper::parseEscapedMarkedown($supplier->notes) : null,
|
||||
'notes' => ($supplier->notes) ? Helper::parseEscapedMarkedownInline($supplier->notes) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($supplier->updated_at, 'datetime'),
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class UsersTransformer
|
||||
'id' => (int) $user->userloc->id,
|
||||
'name'=> e($user->userloc->name),
|
||||
] : null,
|
||||
'notes'=> Helper::parseEscapedMarkedown($user->notes),
|
||||
'notes'=> Helper::parseEscapedMarkedownInline($user->notes),
|
||||
'permissions' => $user->decodePermissions(),
|
||||
'activated' => ($user->activated == '1') ? true : false,
|
||||
'autoassign_licenses' => ($user->autoassign_licenses == '1') ? true : false,
|
||||
|
||||
@@ -27,15 +27,24 @@ class LicenseImporter extends ItemImporter
|
||||
* @since 4.0
|
||||
* @param array $row
|
||||
* @return License|mixed|null
|
||||
* updated @author Jes Vinsmoke
|
||||
* @since 6.1
|
||||
*
|
||||
*/
|
||||
public function createLicenseIfNotExists(array $row)
|
||||
{
|
||||
$editingLicense = false;
|
||||
$license = License::where('name', $this->item['name'])
|
||||
$license = License::where('serial', $this->item['serial'])->where('name', $this->item['name'])
|
||||
->first();
|
||||
if ($license) {
|
||||
if (! $this->updating) {
|
||||
$this->log('A matching License '.$this->item['name'].' with serial '.$this->item['serial'].' already exists');
|
||||
|
||||
if($this->item['serial'] != "") {
|
||||
$this->log('A matching License ' . $this->item['name'] . ' with serial ' . $this->item['serial'] . ' already exists');
|
||||
}
|
||||
else {
|
||||
$this->log('A matching License ' . $this->item['name'] . ' with no serial number already exists');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -57,6 +66,12 @@ class LicenseImporter extends ItemImporter
|
||||
$this->item['maintained'] = $this->findCsvMatch($row, 'maintained');
|
||||
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
|
||||
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
|
||||
$this->item['manufacturer'] = $this->createOrFetchManufacturer($this->findCsvMatch($row, 'manufacturer'));
|
||||
|
||||
if($this->item['reassignable'] == "")
|
||||
{
|
||||
$this->item['reassignable'] = 1;
|
||||
}
|
||||
$this->item['seats'] = $this->findCsvMatch($row, 'seats');
|
||||
|
||||
$this->item["termination_date"] = null;
|
||||
|
||||
@@ -390,7 +390,7 @@ class Asset extends Depreciable
|
||||
*/
|
||||
public function depreciation()
|
||||
{
|
||||
return $this->model->belongsTo(\App\Models\Depreciation::class, 'depreciation_id');
|
||||
return $this->hasOneThrough(\App\Models\Depreciation::class,\App\Models\AssetModel::class,'id','id','model_id','depreciation_id');
|
||||
}
|
||||
|
||||
|
||||
@@ -785,24 +785,17 @@ class Asset extends Depreciable
|
||||
* @since [v4.0]
|
||||
* @return string | false
|
||||
*/
|
||||
public static function autoincrement_asset()
|
||||
public static function autoincrement_asset(int $additional_increment = 0)
|
||||
{
|
||||
$settings = \App\Models\Setting::getSettings();
|
||||
|
||||
|
||||
if ($settings->auto_increment_assets == '1') {
|
||||
$temp_asset_tag = \DB::table('assets')
|
||||
->where('physical', '=', '1')
|
||||
->max('asset_tag');
|
||||
|
||||
$asset_tag_digits = preg_replace('/\D/', '', $temp_asset_tag);
|
||||
$asset_tag = preg_replace('/^0*/', '', $asset_tag_digits);
|
||||
|
||||
if ($settings->zerofill_count > 0) {
|
||||
return $settings->auto_increment_prefix.self::zerofill($settings->next_auto_tag_base, $settings->zerofill_count);
|
||||
return $settings->auto_increment_prefix.self::zerofill($settings->next_auto_tag_base + $additional_increment, $settings->zerofill_count);
|
||||
}
|
||||
|
||||
return $settings->auto_increment_prefix.$settings->next_auto_tag_base;
|
||||
return $settings->auto_increment_prefix.($settings->next_auto_tag_base + $additional_increment);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -1440,6 +1433,12 @@ class Asset extends Depreciable
|
||||
});
|
||||
}
|
||||
|
||||
if ($fieldname == 'rtd_location') {
|
||||
$query->whereHas('defaultLoc', function ($query) use ($search_val) {
|
||||
$query->where('locations.name', 'LIKE', '%'.$search_val.'%');
|
||||
});
|
||||
}
|
||||
|
||||
if ($fieldname =='assigned_to') {
|
||||
$query->whereHasMorph('assignedTo', [User::class], function ($query) use ($search_val) {
|
||||
$query->where(function ($query) use ($search_val) {
|
||||
|
||||
@@ -18,7 +18,7 @@ class CheckoutRequest extends Model
|
||||
|
||||
public function requestingUser()
|
||||
{
|
||||
return $this->user()->first();
|
||||
return $this->user()->withTrashed()->first();
|
||||
}
|
||||
|
||||
public function requestedItem()
|
||||
|
||||
@@ -24,6 +24,9 @@ final class Company extends SnipeModel
|
||||
// Declare the rules for the model validation
|
||||
protected $rules = [
|
||||
'name' => 'required|min:1|max:255|unique:companies,name',
|
||||
'fax' => 'min:7|max:35|nullable',
|
||||
'phone' => 'min:7|max:35|nullable',
|
||||
'email' => 'email|max:150|nullable',
|
||||
];
|
||||
|
||||
protected $presenter = \App\Presenters\CompanyPresenter::class;
|
||||
@@ -45,7 +48,7 @@ final class Company extends SnipeModel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchableAttributes = ['name', 'created_at', 'updated_at'];
|
||||
protected $searchableAttributes = ['name', 'phone', 'fax', 'email', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The relations and their attributes that should be included when searching the model.
|
||||
@@ -59,7 +62,12 @@ final class Company extends SnipeModel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name'];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'phone',
|
||||
'fax',
|
||||
'email',
|
||||
];
|
||||
|
||||
private static function isFullMultipleCompanySupportEnabled()
|
||||
{
|
||||
|
||||
@@ -53,6 +53,7 @@ class CustomField extends Model
|
||||
'element' => 'required|in:text,listbox,textarea,checkbox,radio',
|
||||
'field_encrypted' => 'nullable|boolean',
|
||||
'auto_add_to_fieldsets' => 'boolean',
|
||||
'show_in_listview' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -71,6 +72,7 @@ class CustomField extends Model
|
||||
'is_unique',
|
||||
'display_in_user_view',
|
||||
'auto_add_to_fieldsets',
|
||||
'show_in_listview',
|
||||
|
||||
];
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ class Department extends SnipeModel
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'name',
|
||||
'phone',
|
||||
'fax',
|
||||
'location_id',
|
||||
'company_id',
|
||||
'manager_id',
|
||||
@@ -56,7 +58,7 @@ class Department extends SnipeModel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchableAttributes = ['name', 'notes'];
|
||||
protected $searchableAttributes = ['name', 'notes', 'phone', 'fax'];
|
||||
|
||||
/**
|
||||
* The relations and their attributes that should be included when searching the model.
|
||||
|
||||
@@ -68,7 +68,7 @@ class Depreciable extends SnipeModel
|
||||
*/
|
||||
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
|
||||
{
|
||||
if ($this->purchase_date) {
|
||||
if (($this->get_depreciation()) && ($this->purchase_date)) {
|
||||
$months_passed = ($this->purchase_date->diff(now())->m)+($this->purchase_date->diff(now())->y*12);
|
||||
} else {
|
||||
return null;
|
||||
|
||||
224
app/Models/Labels/DefaultLabel.php
Normal file
224
app/Models/Labels/DefaultLabel.php
Normal file
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Setting;
|
||||
|
||||
class DefaultLabel extends RectangleSheet
|
||||
{
|
||||
private const BARCODE1D_SIZE = 0.15;
|
||||
|
||||
private const BARCODE2D_SIZE = 0.76;
|
||||
private const BARCODE2D_MARGIN = 0.075;
|
||||
|
||||
private const LOGO_SIZE = [0.75, 0.50];
|
||||
private const LOGO_MARGIN = 0.05;
|
||||
|
||||
private const TEXT_MARGIN = 0.04;
|
||||
|
||||
|
||||
private float $textSize;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
private float $labelSpacingH;
|
||||
private float $labelSpacingV;
|
||||
|
||||
private float $pageMarginTop;
|
||||
private float $pageMarginBottom;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginRight;
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
|
||||
private int $columns;
|
||||
private int $rows;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
$this->textSize = Helper::convertUnit($settings->labels_fontsize, 'pt', 'in');
|
||||
|
||||
$this->labelWidth = $settings->labels_width;
|
||||
$this->labelHeight = $settings->labels_height;
|
||||
|
||||
$this->labelSpacingH = $settings->labels_display_sgutter;
|
||||
$this->labelSpacingV = $settings->labels_display_bgutter;
|
||||
|
||||
$this->pageMarginTop = $settings->labels_pmargin_top;
|
||||
$this->pageMarginBottom = $settings->labels_pmargin_bottom;
|
||||
$this->pageMarginLeft = $settings->labels_pmargin_left;
|
||||
$this->pageMarginRight = $settings->labels_pmargin_right;
|
||||
|
||||
$this->pageWidth = $settings->labels_pagewidth;
|
||||
$this->pageHeight = $settings->labels_pageheight;
|
||||
|
||||
$usableWidth = $this->pageWidth - $this->pageMarginLeft - $this->pageMarginRight;
|
||||
$usableHeight = $this->pageHeight - $this->pageMarginTop - $this->pageMarginBottom;
|
||||
|
||||
$this->columns = ($usableWidth + $this->labelSpacingH) / ($this->labelWidth + $this->labelSpacingH);
|
||||
$this->rows = ($usableHeight + $this->labelSpacingV) / ($this->labelHeight + $this->labelSpacingV);
|
||||
}
|
||||
|
||||
public function getUnit() { return 'in'; }
|
||||
|
||||
public function getPageWidth() { return $this->pageWidth; }
|
||||
public function getPageHeight() { return $this->pageHeight; }
|
||||
|
||||
public function getPageMarginTop() { return $this->pageMarginTop; }
|
||||
public function getPageMarginBottom() { return $this->pageMarginBottom; }
|
||||
public function getPageMarginLeft() { return $this->pageMarginLeft; }
|
||||
public function getPageMarginRight() { return $this->pageMarginRight; }
|
||||
|
||||
public function getColumns() { return $this->columns; }
|
||||
public function getRows() { return $this->rows; }
|
||||
public function getLabelBorder() { return 0.01; }
|
||||
|
||||
public function getLabelWidth() { return $this->labelWidth; }
|
||||
public function getLabelHeight() { return $this->labelHeight; }
|
||||
|
||||
public function getLabelMarginTop() { return 0; }
|
||||
public function getLabelMarginBottom() { return 0; }
|
||||
public function getLabelMarginLeft() { return 0; }
|
||||
public function getLabelMarginRight() { return 0; }
|
||||
|
||||
public function getLabelColumnSpacing() { return $this->labelSpacingH; }
|
||||
public function getLabelRowSpacing() { return $this->labelSpacingV; }
|
||||
|
||||
public function getSupportAssetTag() { return false; }
|
||||
public function getSupport1DBarcode() { return true; }
|
||||
public function getSupport2DBarcode() { return true; }
|
||||
public function getSupportFields() { return 4; }
|
||||
public function getSupportTitle() { return true; }
|
||||
public function getSupportLogo() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
|
||||
$asset = $record->get('asset');
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
$textY = 0;
|
||||
$textX1 = 0;
|
||||
$textX2 = $this->getLabelWidth();
|
||||
|
||||
// 1D Barcode
|
||||
if ($record->get('barcode1d')) {
|
||||
static::write1DBarcode(
|
||||
$pdf, $record->get('barcode1d')->content, $record->get('barcode1d')->type,
|
||||
0.05, $this->getLabelHeight() - self::BARCODE1D_SIZE,
|
||||
$this->getLabelWidth() - 0.1, self::BARCODE1D_SIZE
|
||||
);
|
||||
}
|
||||
|
||||
// 2D Barcode
|
||||
if ($record->get('barcode2d')) {
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
0, 0, self::BARCODE2D_SIZE, self::BARCODE2D_SIZE
|
||||
);
|
||||
$textX1 += self::BARCODE2D_SIZE + self::BARCODE2D_MARGIN;
|
||||
}
|
||||
|
||||
// Logo
|
||||
if ($record->get('logo')) {
|
||||
$logoSize = static::writeImage(
|
||||
$pdf, $record->get('logo'),
|
||||
$this->labelWidth - self::LOGO_SIZE[0], 0,
|
||||
self::LOGO_SIZE[0], self::LOGO_SIZE[1],
|
||||
'R', 'T', 300, true, false, 0
|
||||
);
|
||||
$textX2 -= ($logoSize[0] + self::LOGO_MARGIN);
|
||||
}
|
||||
|
||||
$textW = $textX2 - $textX1;
|
||||
|
||||
// Title
|
||||
if ($record->get('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$textX1, 0,
|
||||
'freesans', 'b', $this->textSize, 'L',
|
||||
$textW, $this->textSize,
|
||||
true, 0
|
||||
);
|
||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
||||
}
|
||||
|
||||
// Fields
|
||||
$fieldsDone = 0;
|
||||
if ($settings->labels_display_name && $fieldsDone < $this->getSupportFields()) {
|
||||
if ($asset->name) {
|
||||
static::writeText(
|
||||
$pdf, 'N: '.$asset->name,
|
||||
$textX1, $textY,
|
||||
'freesans', '', $this->textSize, 'L',
|
||||
$textW, $this->textSize,
|
||||
true, 0
|
||||
);
|
||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
||||
$fieldsDone++;
|
||||
}
|
||||
}
|
||||
if ($settings->labels_display_company_name && $fieldsDone < $this->getSupportFields()) {
|
||||
if ($asset->company) {
|
||||
static::writeText(
|
||||
$pdf, 'C: '.$asset->company->name,
|
||||
$textX1, $textY,
|
||||
'freesans', '', $this->textSize, 'L',
|
||||
$textW, $this->textSize,
|
||||
true, 0
|
||||
);
|
||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
||||
$fieldsDone++;
|
||||
}
|
||||
}
|
||||
if ($settings->labels_display_tag && $fieldsDone < $this->getSupportFields()) {
|
||||
if ($asset->asset_tag) {
|
||||
static::writeText(
|
||||
$pdf, 'T: '.$asset->asset_tag,
|
||||
$textX1, $textY,
|
||||
'freesans', '', $this->textSize, 'L',
|
||||
$textW, $this->textSize,
|
||||
true, 0
|
||||
);
|
||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
||||
$fieldsDone++;
|
||||
}
|
||||
}
|
||||
if ($settings->labels_display_serial && $fieldsDone < $this->getSupportFields()) {
|
||||
if ($asset->serial) {
|
||||
static::writeText(
|
||||
$pdf, 'S: '.$asset->serial,
|
||||
$textX1, $textY,
|
||||
'freesans', '', $this->textSize, 'L',
|
||||
$textW, $this->textSize,
|
||||
true, 0
|
||||
);
|
||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
||||
$fieldsDone++;
|
||||
}
|
||||
}
|
||||
if ($settings->labels_display_model && $fieldsDone < $this->getSupportFields()) {
|
||||
if ($asset->model) {
|
||||
static::writeText(
|
||||
$pdf, 'M: '.$asset->model->name,
|
||||
$textX1, $textY,
|
||||
'freesans', '', $this->textSize, 'L',
|
||||
$textW, $this->textSize,
|
||||
true, 0
|
||||
);
|
||||
$textY += $this->textSize + self::TEXT_MARGIN;
|
||||
$fieldsDone++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
39
app/Models/Labels/Field.php
Normal file
39
app/Models/Labels/Field.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels;
|
||||
|
||||
use App\Models\Asset;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class Field {
|
||||
protected Collection $options;
|
||||
public function getOptions() { return $this->options; }
|
||||
public function setOptions($options) {
|
||||
$tempCollect = collect($options);
|
||||
if (!$tempCollect->contains(fn($o) => !is_subclass_of($o, FieldOption::class))) {
|
||||
$this->options = $options;
|
||||
}
|
||||
}
|
||||
|
||||
public function toArray(Asset $asset) { return Field::makeArray($this, $asset); }
|
||||
|
||||
/* Statics */
|
||||
|
||||
public static function makeArray(Field $field, Asset $asset) {
|
||||
return $field->getOptions()
|
||||
->map(fn($option) => $option->toArray($asset))
|
||||
->filter(fn($result) => $result['value'] != null);
|
||||
}
|
||||
|
||||
public static function makeString(Field $option) {
|
||||
return implode('|', $option->getOptions());
|
||||
}
|
||||
|
||||
public static function fromString(string $theString) {
|
||||
$field = new Field();
|
||||
$field->options = collect(explode('|', $theString))
|
||||
->filter(fn($optionString) => !empty($optionString))
|
||||
->map(fn($optionString) => FieldOption::fromString($optionString));
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
49
app/Models/Labels/FieldOption.php
Normal file
49
app/Models/Labels/FieldOption.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels;
|
||||
|
||||
use App\Models\Asset;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class FieldOption {
|
||||
protected string $label;
|
||||
public function getLabel() { return $this->label; }
|
||||
|
||||
protected string $dataSource;
|
||||
public function getDataSource() { return $this->dataSource; }
|
||||
|
||||
public function getValue(Asset $asset) {
|
||||
$dataPath = collect(explode('.', $this->dataSource));
|
||||
return $dataPath->reduce(function ($myValue, $path) {
|
||||
try { return $myValue ? $myValue->{$path} : ${$myValue}; }
|
||||
catch (\Exception $e) { return $myValue; }
|
||||
}, $asset);
|
||||
}
|
||||
|
||||
public function toArray(Asset $asset=null) { return FieldOption::makeArray($this, $asset); }
|
||||
public function toString() { return FieldOption::makeString($this); }
|
||||
|
||||
/* Statics */
|
||||
|
||||
public static function makeArray(FieldOption $option, Asset $asset=null) {
|
||||
return [
|
||||
'label' => $option->getLabel(),
|
||||
'dataSource' => $option->getDataSource(),
|
||||
'value' => $asset ? $option->getValue($asset) : null
|
||||
];
|
||||
}
|
||||
|
||||
public static function makeString(FieldOption $option) {
|
||||
return $option->getLabel() . '=' . $option->getDataSource();
|
||||
}
|
||||
|
||||
public static function fromString(string $theString) {
|
||||
$parts = explode('=', $theString);
|
||||
if (count($parts) == 2) {
|
||||
$option = new FieldOption();
|
||||
$option->label = $parts[0];
|
||||
$option->dataSource = $parts[1];
|
||||
return $option;
|
||||
}
|
||||
}
|
||||
}
|
||||
598
app/Models/Labels/Label.php
Normal file
598
app/Models/Labels/Label.php
Normal file
@@ -0,0 +1,598 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use TCPDF;
|
||||
use TCPDF_STATIC;
|
||||
|
||||
/**
|
||||
* Model for Labels.
|
||||
*
|
||||
* @version v1.0
|
||||
*/
|
||||
abstract class Label
|
||||
{
|
||||
/**
|
||||
* Returns the unit of measure used
|
||||
* 'pt', 'mm', 'cm', 'in'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public abstract function getUnit();
|
||||
|
||||
/**
|
||||
* Returns the label's width in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getWidth();
|
||||
|
||||
/**
|
||||
* Returns the label's height in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getHeight();
|
||||
|
||||
/**
|
||||
* Returns the label's top margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getMarginTop();
|
||||
|
||||
/**
|
||||
* Returns the label's bottom margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getMarginBottom();
|
||||
|
||||
/**
|
||||
* Returns the label's left margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getMarginLeft();
|
||||
|
||||
/**
|
||||
* Returns the label's right margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getMarginRight();
|
||||
|
||||
/**
|
||||
* Returns whether the template supports an asset tag.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public abstract function getSupportAssetTag();
|
||||
|
||||
/**
|
||||
* Returns whether the template supports a 1D barcode.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public abstract function getSupport1DBarcode();
|
||||
|
||||
/**
|
||||
* Returns whether the template supports a 2D barcode.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public abstract function getSupport2DBarcode();
|
||||
|
||||
/**
|
||||
* Returns the number of fields the template supports.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public abstract function getSupportFields();
|
||||
|
||||
/**
|
||||
* Returns whether the template supports a logo.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public abstract function getSupportLogo();
|
||||
|
||||
/**
|
||||
* Returns whether the template supports a title.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public abstract function getSupportTitle();
|
||||
|
||||
/**
|
||||
* Make changes to the PDF properties here. OPTIONAL.
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
*/
|
||||
public abstract function preparePDF(TCPDF $pdf);
|
||||
|
||||
/**
|
||||
* Write single data record as content here.
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
* @param Collection $record A data record
|
||||
*/
|
||||
public abstract function write(TCPDF $pdf, Collection $record);
|
||||
|
||||
/**
|
||||
* Handle the data here. Override for multiple-per-page handling
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
* @param Collection $data The data
|
||||
*/
|
||||
public function writeAll(TCPDF $pdf, Collection $data) {
|
||||
$data->each(function ($record, $index) use ($pdf) {
|
||||
$pdf->AddPage();
|
||||
$this->write($pdf, $record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the qualified class name relative to the Label class's namespace.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public final function getName() {
|
||||
$refClass = new \ReflectionClass(Label::class);
|
||||
return str_replace($refClass->getNamespaceName() . '\\', '', get_class($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label's orientation as a string.
|
||||
* 'L' = Landscape
|
||||
* 'P' = Portrait
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public final function getOrientation() {
|
||||
return ($this->getWidth() >= $this->getHeight()) ? 'L' : 'P';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label's printable area as an object.
|
||||
*
|
||||
* @return object [ 'x1'=>0.00, 'y1'=>0.00, 'x2'=>0.00, 'y2'=>0.00, 'w'=>0.00, 'h'=>0.00 ]
|
||||
*/
|
||||
public final function getPrintableArea() {
|
||||
return (object)[
|
||||
'x1' => $this->getMarginLeft(),
|
||||
'y1' => $this->getMarginTop(),
|
||||
'x2' => $this->getWidth() - $this->getMarginRight(),
|
||||
'y2' => $this->getHeight() - $this->getMarginBottom(),
|
||||
'w' => $this->getWidth() - $this->getMarginLeft() - $this->getMarginRight(),
|
||||
'h' => $this->getHeight() - $this->getMarginTop() - $this->getMarginBottom(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a text cell.
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
* @param string $text The text to write. Supports 'some **bold** text'.
|
||||
* @param float $x X position of top-left
|
||||
* @param float $y Y position of top-left
|
||||
* @param string $font The font family
|
||||
* @param string $style The font style
|
||||
* @param int $size The font size in getUnit() units
|
||||
* @param string $align Align text in the box. 'L' left, 'R' right, 'C' center.
|
||||
* @param float $width Force text box width. NULL to auto-fit.
|
||||
* @param float $height Force text box height. NULL to auto-fit.
|
||||
* @param bool $squash Squash text if it's too big
|
||||
* @param int $border Thickness of border. Default = 0.
|
||||
* @param int $spacing Letter spacing. Default = 0.
|
||||
*/
|
||||
public final function writeText(TCPDF $pdf, $text, $x, $y, $font=null, $style=null, $size=null, $align='L', $width=null, $height=null, $squash=false, $border=0, $spacing=0) {
|
||||
$prevFamily = $pdf->getFontFamily();
|
||||
$prevStyle = $pdf->getFontStyle();
|
||||
$prevSizePt = $pdf->getFontSizePt();
|
||||
|
||||
$text = !empty($text) ? $text : '';
|
||||
|
||||
$fontFamily = !empty($font) ? $font : $prevFamily;
|
||||
$fontStyle = !empty($style) ? $style : $prevStyle;
|
||||
if ($size) $fontSizePt = Helper::convertUnit($size, $this->getUnit(), 'pt', true);
|
||||
else $fontSizePt = $prevSizePt;
|
||||
|
||||
$pdf->SetFontSpacing($spacing);
|
||||
|
||||
$parts = collect(explode('**', $text))
|
||||
->map(function ($part, $index) use ($pdf, $fontFamily, $fontStyle, $fontSizePt) {
|
||||
$modStyle = ($index % 2 == 1) ? 'B' : $fontStyle;
|
||||
$pdf->setFont($fontFamily, $modStyle, $fontSizePt);
|
||||
return [
|
||||
'text' => $part,
|
||||
'text_width' => $pdf->GetStringWidth($part),
|
||||
'font_family' => $fontFamily,
|
||||
'font_style' => $modStyle,
|
||||
'font_size' => $fontSizePt,
|
||||
];
|
||||
});
|
||||
|
||||
$textWidth = $parts->reduce(function ($carry, $part) { return $carry += $part['text_width']; });
|
||||
$cellWidth = !empty($width) ? $width : $textWidth;
|
||||
|
||||
if ($squash && ($textWidth > 0)) {
|
||||
$scaleFactor = min(1.0, $cellWidth / $textWidth);
|
||||
$parts = $parts->map(function ($part, $index) use ($scaleFactor) {
|
||||
$part['text_width'] = $part['text_width'] * $scaleFactor;
|
||||
return $part;
|
||||
});
|
||||
}
|
||||
$cellHeight = !empty($height) ? $height : Helper::convertUnit($fontSizePt, 'pt', $this->getUnit());
|
||||
|
||||
if ($border) {
|
||||
$prevLineWidth = $pdf->getLineWidth();
|
||||
$pdf->setLineWidth($border);
|
||||
$pdf->Rect($x, $y, $cellWidth, $cellHeight);
|
||||
$pdf->setLineWidth($prevLineWidth);
|
||||
}
|
||||
|
||||
switch($align) {
|
||||
case 'R': $startX = ($x + $cellWidth) - min($cellWidth, $textWidth); break;
|
||||
case 'C': $startX = ($x + ($cellWidth / 2)) - (min($cellWidth, $textWidth) / 2); break;
|
||||
case 'L':
|
||||
default: $startX = $x; break;
|
||||
}
|
||||
|
||||
$parts->reduce(function ($currentX, $part) use ($pdf, $y, $cellHeight) {
|
||||
$pdf->SetXY($currentX, $y);
|
||||
$pdf->setFont($part['font_family'], $part['font_style'], $part['font_size']);
|
||||
$pdf->Cell($part['text_width'], $cellHeight, $part['text'], 0, 0, '', false, '', 1, true);
|
||||
return $currentX += $part['text_width'];
|
||||
}, $startX);
|
||||
|
||||
$pdf->SetFont($prevFamily, $prevStyle, $prevSizePt);
|
||||
$pdf->SetFontSpacing(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an image.
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
* @param string $image The image to write
|
||||
* @param float $x X position of top-left
|
||||
* @param float $y Y position of top-left
|
||||
* @param float $width The container width
|
||||
* @param float $height The container height
|
||||
* @param string $halign Align text in the box. 'L' left, 'R' right, 'C' center. Default 'L'.
|
||||
* @param string $valign Align text in the box. 'T' top, 'B' bottom, 'C' center. Default 'T'.
|
||||
* @param int $dpi Pixels per inch
|
||||
* @param bool $resize Resize to fit container
|
||||
* @param bool $stretch Stretch (vs Scale) to fit container
|
||||
* @param int $border Thickness of border. Default = 0.
|
||||
*
|
||||
* @return array Returns the final calculated size [w,h]
|
||||
*/
|
||||
public final function writeImage(TCPDF $pdf, $image, $x, $y, $width=null, $height=null, $halign='L', $valign='L', $dpi=300, $resize=false, $stretch=false, $border=0) {
|
||||
|
||||
if (empty($image)) return [0,0];
|
||||
|
||||
$imageInfo = getimagesize($image);
|
||||
if (!$imageInfo) return [0,0]; // TODO: SVG or other
|
||||
|
||||
$imageWidthPx = $imageInfo[0];
|
||||
$imageHeightPx = $imageInfo[1];
|
||||
$imageType = image_type_to_extension($imageInfo[2], false);
|
||||
|
||||
$imageRatio = $imageWidthPx / $imageHeightPx;
|
||||
$dpu = Helper::convertUnit($dpi, $this->getUnit(), 'in');
|
||||
$imageWidth = $imageWidthPx / $dpu;
|
||||
$imageHeight = $imageHeightPx / $dpu;
|
||||
|
||||
$outputWidth = $imageWidth;
|
||||
$outputHeight = $imageHeight;
|
||||
|
||||
if ($resize) {
|
||||
// Assign specified parameters
|
||||
$limitWidth = $width;
|
||||
$limitHeight = $height;
|
||||
|
||||
// If not, try calculating from the other dimension
|
||||
$limitWidth = ($limitWidth > 0) ? $limitWidth : ($limitHeight / $imageRatio);
|
||||
$limitHeight = ($limitHeight > 0) ? $limitHeight : ($limitWidth * $imageRatio);
|
||||
|
||||
// If not, just use the image size
|
||||
$limitWidth = ($limitWidth > 0) ? $limitWidth : $imageWidth;
|
||||
$limitHeight = ($limitHeight > 0) ? $limitHeight : $imageHeight;
|
||||
|
||||
$scaleWidth = $limitWidth / $imageWidth;
|
||||
$scaleHeight = $limitHeight / $imageHeight;
|
||||
|
||||
// If non-stretch, make both scales factors equal
|
||||
if (!$stretch) {
|
||||
// Do we need to scale down at all? That's most important.
|
||||
if (($scaleWidth < 1.0) || ($scaleHeight < 1.0)) {
|
||||
// Choose largest scale-down
|
||||
$scaleWidth = min($scaleWidth, $scaleHeight);
|
||||
} else {
|
||||
// Choose smallest scale-up
|
||||
$scaleWidth = min(max($scaleWidth, 1.0), max($scaleHeight, 1.0));
|
||||
}
|
||||
$scaleHeight = $scaleWidth;
|
||||
}
|
||||
|
||||
$outputWidth = $imageWidth * $scaleWidth;
|
||||
$outputHeight = $imageHeight * $scaleHeight;
|
||||
}
|
||||
|
||||
// Container
|
||||
$containerWidth = !empty($width) ? $width : $outputWidth;
|
||||
$containerHeight = !empty($height) ? $height : $outputHeight;
|
||||
|
||||
// Horizontal Position
|
||||
switch ($halign) {
|
||||
case 'R': $originX = ($x + $containerWidth) - $outputWidth; break;
|
||||
case 'C': $originX = ($x + ($containerWidth / 2)) - ($outputWidth / 2); break;
|
||||
case 'L':
|
||||
default: $originX = $x; break;
|
||||
}
|
||||
|
||||
// Vertical Position
|
||||
switch ($valign) {
|
||||
case 'B': $originY = ($y + $containerHeight) - $outputHeight; break;
|
||||
case 'C': $originY = ($y + ($containerHeight / 2)) - ($outputHeight / 2); break;
|
||||
case 'T':
|
||||
default: $originY = $y; break;
|
||||
}
|
||||
|
||||
// Actual Image
|
||||
$pdf->Image($image, $originX, $originY, $outputWidth, $outputHeight, $imageType, '', '', true);
|
||||
|
||||
// Border
|
||||
if ($border) {
|
||||
$prevLineWidth = $pdf->getLineWidth();
|
||||
$pdf->setLineWidth($border);
|
||||
$pdf->Rect($x, $y, $containerWidth, $containerHeight);
|
||||
$pdf->setLineWidth($prevLineWidth);
|
||||
}
|
||||
|
||||
return [ $outputWidth, $outputHeight ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a 1D barcode.
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
* @param string $value The barcode content
|
||||
* @param string $type The barcode type
|
||||
* @param float $x X position of top-left
|
||||
* @param float $y Y position of top-left
|
||||
* @param float $width The container width
|
||||
* @param float $height The container height
|
||||
*/
|
||||
public final function write1DBarcode(TCPDF $pdf, $value, $type, $x, $y, $width, $height) {
|
||||
if (empty($value)) return;
|
||||
$pdf->write1DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a 2D barcode.
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
* @param string $value The barcode content
|
||||
* @param string $type The barcode type
|
||||
* @param float $x X position of top-left
|
||||
* @param float $y Y position of top-left
|
||||
* @param float $width The container width
|
||||
* @param float $height The container height
|
||||
*/
|
||||
public final function write2DBarcode(TCPDF $pdf, $value, $type, $x, $y, $width, $height) {
|
||||
if (empty($value)) return;
|
||||
$pdf->write2DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks the template is internally valid
|
||||
*/
|
||||
public final function validate() {
|
||||
$this->validateUnits();
|
||||
$this->validateSize();
|
||||
$this->validateMargins();
|
||||
$this->validateSupport();
|
||||
}
|
||||
|
||||
private function validateUnits() {
|
||||
$validUnits = [ 'pt', 'mm', 'cm', 'in' ];
|
||||
$unit = $this->getUnit();
|
||||
if (!in_array(strtolower($unit), $validUnits)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_value', [
|
||||
'name' => 'getUnit()',
|
||||
'expected' => '[ \''.implode('\', \'', $validUnits).'\' ]',
|
||||
'actual' => '\''.$unit.'\''
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
private function validateSize() {
|
||||
$width = $this->getWidth();
|
||||
if (!is_numeric($width) || is_string($width)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getWidth()',
|
||||
'expected' => 'float',
|
||||
'actual' => gettype($width)
|
||||
]));
|
||||
}
|
||||
|
||||
$height = $this->getHeight();
|
||||
if (!is_numeric($height) || is_string($height)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getHeight()',
|
||||
'expected' => 'float',
|
||||
'actual' => gettype($height)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
private function validateMargins() {
|
||||
$marginTop = $this->getMarginTop();
|
||||
if (!is_numeric($marginTop) || is_string($marginTop)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getMarginTop()',
|
||||
'expected' => 'float',
|
||||
'actual' => gettype($marginTop)
|
||||
]));
|
||||
}
|
||||
|
||||
$marginBottom = $this->getMarginBottom();
|
||||
if (!is_numeric($marginBottom) || is_string($marginBottom)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getMarginBottom()',
|
||||
'expected' => 'float',
|
||||
'actual' => gettype($marginBottom)
|
||||
]));
|
||||
}
|
||||
|
||||
$marginLeft = $this->getMarginLeft();
|
||||
if (!is_numeric($marginLeft) || is_string($marginLeft)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getMarginLeft()',
|
||||
'expected' => 'float',
|
||||
'actual' => gettype($marginLeft)
|
||||
]));
|
||||
}
|
||||
|
||||
$marginRight = $this->getMarginRight();
|
||||
if (!is_numeric($marginRight) || is_string($marginRight)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getMarginRight()',
|
||||
'expected' => 'float',
|
||||
'actual' => gettype($marginRight)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
private function validateSupport() {
|
||||
$support1D = $this->getSupport1DBarcode();
|
||||
if (!is_bool($support1D)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getSupport1DBarcode()',
|
||||
'expected' => 'boolean',
|
||||
'actual' => gettype($support1D)
|
||||
]));
|
||||
}
|
||||
|
||||
$support2D = $this->getSupport2DBarcode();
|
||||
if (!is_bool($support2D)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getSupport2DBarcode()',
|
||||
'expected' => 'boolean',
|
||||
'actual' => gettype($support2D)
|
||||
]));
|
||||
}
|
||||
|
||||
$supportFields = $this->getSupportFields();
|
||||
if (!is_int($supportFields)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getSupportFields()',
|
||||
'expected' => 'integer',
|
||||
'actual' => gettype($supportFields)
|
||||
]));
|
||||
}
|
||||
|
||||
$supportLogo = $this->getSupportLogo();
|
||||
if (!is_bool($supportLogo)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getSupportLogo()',
|
||||
'expected' => 'boolean',
|
||||
'actual' => gettype($supportLogo)
|
||||
]));
|
||||
}
|
||||
|
||||
$supportTitle = $this->getSupportTitle();
|
||||
if (!is_bool($supportTitle)) {
|
||||
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
|
||||
'name' => 'getSupportTitle()',
|
||||
'expected' => 'boolean',
|
||||
'actual' => gettype($supportTitle)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Public Static Functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Find size of a page by its format.
|
||||
*
|
||||
* @param string $format Format name (eg: 'A4', 'LETTER', etc.)
|
||||
* @param string $orientation 'L' for Landscape, 'P' for Portrait ('L' default)
|
||||
* @param string $unit Unit of measure to return in ('mm' default)
|
||||
*
|
||||
* @return object (object)[ 'width' => (float)123.4, 'height' => (float)123.4 ]
|
||||
*/
|
||||
public static function fromFormat($format, $orientation='L', $unit='mm', $round=false) {
|
||||
$size = collect(TCPDF_STATIC::getPageSizeFromFormat(strtoupper($format)))
|
||||
->sort()
|
||||
->map(function ($value) use ($unit) {
|
||||
return Helper::convertUnit($value, 'pt', $unit);
|
||||
})
|
||||
->toArray();
|
||||
$width = ($orientation == 'L') ? $size[1] : $size[0];
|
||||
$height = ($orientation == 'L') ? $size[0] : $size[1];
|
||||
return (object)[
|
||||
'width' => ($round !== false) ? round($width, $round) : $width,
|
||||
'height' => ($round !== false) ? round($height, $round) : $height,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a Label by its path (or just return them all).
|
||||
*
|
||||
* Unlike most Models, these are defined by their existence as non-
|
||||
* abstract classes stored in Models\Labels.
|
||||
*
|
||||
* @param string|Arrayable|array|null $path Label path[s]
|
||||
* @return Collection|Label|null
|
||||
*/
|
||||
public static function find($name=null) {
|
||||
// Find many
|
||||
if (is_array($name) || $name instanceof Arrayable) {
|
||||
$labels = collect($name)
|
||||
->map(function ($thisname) {
|
||||
return static::find($thisname);
|
||||
})
|
||||
->whereNotNull();
|
||||
return ($labels->count() > 0) ? $labels : null;
|
||||
}
|
||||
|
||||
// Find one
|
||||
if ($name !== null) {
|
||||
return static::find()
|
||||
->sole(function ($label) use ($name) {
|
||||
return $label->getName() == $name;
|
||||
});
|
||||
}
|
||||
|
||||
// Find all
|
||||
return collect(File::allFiles(__DIR__))
|
||||
->map(function ($file) {
|
||||
preg_match_all('/\/*(.+?)(?:\/|\.)/', $file->getRelativePathName(), $matches);
|
||||
return __NAMESPACE__ . '\\' . implode('\\', $matches[1]);
|
||||
})
|
||||
->filter(function ($name) {
|
||||
if (!class_exists($name)) return false;
|
||||
$refClass = new \ReflectionClass($name);
|
||||
if ($refClass->isAbstract()) return false;
|
||||
return $refClass->isSubclassOf(Label::class);
|
||||
})
|
||||
->map(function ($name) {
|
||||
return new $name();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
48
app/Models/Labels/RectangleSheet.php
Normal file
48
app/Models/Labels/RectangleSheet.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels;
|
||||
|
||||
abstract class RectangleSheet extends Sheet
|
||||
{
|
||||
/**
|
||||
* Returns the number of columns per sheet
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public abstract function getColumns();
|
||||
|
||||
/**
|
||||
* Returns the number of rows per sheet
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public abstract function getRows();
|
||||
|
||||
/**
|
||||
* Returns the spacing between columns
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public abstract function getLabelColumnSpacing();
|
||||
|
||||
/**
|
||||
* Returns the spacing between rows
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public abstract function getLabelRowSpacing();
|
||||
|
||||
|
||||
public function getLabelsPerPage() { return $this->getColumns() * $this->getRows(); }
|
||||
|
||||
public function getLabelPosition($index) {
|
||||
$printIndex = $index + $this->getLabelIndexOffset();
|
||||
$row = (int)($printIndex / $this->getColumns());
|
||||
$col = $printIndex - ($row * $this->getColumns());
|
||||
$x = $this->getPageMarginLeft() + (($this->getLabelWidth() + $this->getLabelColumnSpacing()) * $col);
|
||||
$y = $this->getPageMarginTop() + (($this->getLabelHeight() + $this->getLabelRowSpacing()) * $row);
|
||||
return [ $x, $y ];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
209
app/Models/Labels/Sheet.php
Normal file
209
app/Models/Labels/Sheet.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels;
|
||||
|
||||
abstract class Sheet extends Label
|
||||
{
|
||||
protected int $indexOffset = 0;
|
||||
|
||||
public function getWidth() { return $this->getPageWidth(); }
|
||||
public function getHeight() { return $this->getPageHeight(); }
|
||||
public function getMarginTop() { return $this->getPageMarginTop(); }
|
||||
public function getMarginBottom() { return $this->getPageMarginBottom(); }
|
||||
public function getMarginLeft() { return $this->getPageMarginLeft(); }
|
||||
public function getMarginRight() { return $this->getPageMarginRight(); }
|
||||
|
||||
/**
|
||||
* Returns the page width in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getPageWidth();
|
||||
|
||||
/**
|
||||
* Returns the page height in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getPageHeight();
|
||||
|
||||
/**
|
||||
* Returns the page top margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getPageMarginTop();
|
||||
|
||||
/**
|
||||
* Returns the page bottom margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getPageMarginBottom();
|
||||
|
||||
/**
|
||||
* Returns the page left margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getPageMarginLeft();
|
||||
|
||||
/**
|
||||
* Returns the page right margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getPageMarginRight();
|
||||
|
||||
/**
|
||||
* Returns the page width in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getLabelWidth();
|
||||
|
||||
/**
|
||||
* Returns each label's height in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getLabelHeight();
|
||||
|
||||
/**
|
||||
* Returns each label's top margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getLabelMarginTop();
|
||||
|
||||
/**
|
||||
* Returns each label's bottom margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getLabelMarginBottom();
|
||||
|
||||
/**
|
||||
* Returns each label's left margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getLabelMarginLeft();
|
||||
|
||||
/**
|
||||
* Returns each label's right margin in getUnit() units
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public abstract function getLabelMarginRight();
|
||||
|
||||
/**
|
||||
* Returns the number of labels each page supports
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public abstract function getLabelsPerPage();
|
||||
|
||||
/**
|
||||
* Returns label position based on its index
|
||||
*
|
||||
* @param int $index
|
||||
*
|
||||
* @return array [x,y]
|
||||
*/
|
||||
public abstract function getLabelPosition(int $index);
|
||||
|
||||
/**
|
||||
* Returns the border to draw around labels
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public abstract function getLabelBorder();
|
||||
|
||||
/**
|
||||
* Handle the data here. Override for multiple-per-page handling
|
||||
*
|
||||
* @param TCPDF $pdf The TCPDF instance
|
||||
* @param Collection $data The data
|
||||
*/
|
||||
public function writeAll($pdf, $data) {
|
||||
$prevPageNumber = -1;
|
||||
|
||||
foreach ($data->toArray() as $recordIndex => $record) {
|
||||
|
||||
$pageNumber = (int)($recordIndex / $this->getLabelsPerPage());
|
||||
if ($pageNumber != $prevPageNumber) {
|
||||
$pdf->AddPage();
|
||||
$prevPageNumber = $pageNumber;
|
||||
}
|
||||
|
||||
$pageIndex = $recordIndex - ($this->getLabelsPerPage() * $pageNumber);
|
||||
$position = $this->getLabelPosition($pageIndex);
|
||||
|
||||
$pdf->StartTemplate();
|
||||
$this->write($pdf, $data->get($recordIndex));
|
||||
$template = $pdf->EndTemplate();
|
||||
|
||||
$pdf->printTemplate($template, $position[0], $position[1]);
|
||||
|
||||
if ($this->getLabelBorder()) {
|
||||
$prevLineWidth = $pdf->GetLineWidth();
|
||||
|
||||
$borderThickness = $this->getLabelBorder();
|
||||
$borderOffset = $borderThickness / 2;
|
||||
$borderX = $position[0]- $borderOffset;
|
||||
$borderY = $position[1] - $borderOffset;
|
||||
$borderW = $this->getLabelWidth() + $borderThickness;
|
||||
$borderH = $this->getLabelHeight() + $borderThickness;
|
||||
|
||||
$pdf->setLineWidth($borderThickness);
|
||||
$pdf->Rect($borderX, $borderY, $borderW, $borderH);
|
||||
$pdf->setLineWidth($prevLineWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns each label's orientation as a string.
|
||||
* 'L' = Landscape
|
||||
* 'P' = Portrait
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public final function getLabelOrientation() {
|
||||
return ($this->getLabelWidth() >= $this->getLabelHeight()) ? 'L' : 'P';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns each label's printable area as an object.
|
||||
*
|
||||
* @return object [ 'x1'=>0.00, 'y1'=>0.00, 'x2'=>0.00, 'y2'=>0.00, 'w'=>0.00, 'h'=>0.00 ]
|
||||
*/
|
||||
public final function getLabelPrintableArea() {
|
||||
return (object)[
|
||||
'x1' => $this->getLabelMarginLeft(),
|
||||
'y1' => $this->getLabelMarginTop(),
|
||||
'x2' => $this->getLabelWidth() - $this->getLabelMarginRight(),
|
||||
'y2' => $this->getLabelHeight() - $this->getLabelMarginBottom(),
|
||||
'w' => $this->getLabelWidth() - $this->getLabelMarginLeft() - $this->getLabelMarginRight(),
|
||||
'h' => $this->getLabelHeight() - $this->getLabelMarginTop() - $this->getLabelMarginBottom(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns label index offset (skip positions)
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLabelIndexOffset() { return $this->indexOffset; }
|
||||
|
||||
/**
|
||||
* Sets label index offset (skip positions)
|
||||
*
|
||||
* @param int $offset
|
||||
*
|
||||
*/
|
||||
public function setLabelIndexOffset(int $offset) { $this->indexOffset = $offset; }
|
||||
}
|
||||
|
||||
?>
|
||||
71
app/Models/Labels/Sheets/Avery/L7162.php
Normal file
71
app/Models/Labels/Sheets/Avery/L7162.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class L7162 extends RectangleSheet
|
||||
{
|
||||
|
||||
private const PAPER_FORMAT = 'A4';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
/* Data in pt from Word Template */
|
||||
private const COLUMN1_X = 13.25;
|
||||
private const COLUMN2_X = 301.25;
|
||||
private const ROW1_Y = 37.00;
|
||||
private const ROW2_Y = 133.00;
|
||||
private const LABEL_W = 280.80;
|
||||
private const LABEL_H = 96.00;
|
||||
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct() {
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
|
||||
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
|
||||
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
|
||||
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth() { return $this->pageWidth; }
|
||||
public function getPageHeight() { return $this->pageHeight; }
|
||||
|
||||
public function getPageMarginTop() { return $this->pageMarginTop; }
|
||||
public function getPageMarginBottom() { return $this->pageMarginTop; }
|
||||
public function getPageMarginLeft() { return $this->pageMarginLeft; }
|
||||
public function getPageMarginRight() { return $this->pageMarginLeft; }
|
||||
|
||||
public function getColumns() { return 2; }
|
||||
public function getRows() { return 8; }
|
||||
|
||||
public function getLabelColumnSpacing() { return $this->columnSpacing; }
|
||||
public function getLabelRowSpacing() { return $this->rowSpacing; }
|
||||
|
||||
public function getLabelWidth() { return $this->labelWidth; }
|
||||
public function getLabelHeight() { return $this->labelHeight; }
|
||||
|
||||
public function getLabelBorder() { return 0; }
|
||||
}
|
||||
|
||||
?>
|
||||
100
app/Models/Labels/Sheets/Avery/L7162_A.php
Normal file
100
app/Models/Labels/Sheets/Avery/L7162_A.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class L7162_A extends L7162
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.60;
|
||||
private const TAG_SIZE = 4.60;
|
||||
private const TITLE_SIZE = 4.20;
|
||||
private const TITLE_MARGIN = 1.40;
|
||||
private const LABEL_SIZE = 2.20;
|
||||
private const LABEL_MARGIN = - 0.50;
|
||||
private const FIELD_SIZE = 4.60;
|
||||
private const FIELD_MARGIN = 0.30;
|
||||
|
||||
public function getUnit() { return 'mm'; }
|
||||
|
||||
public function getLabelMarginTop() { return 1.0; }
|
||||
public function getLabelMarginBottom() { return 1.0; }
|
||||
public function getLabelMarginLeft() { return 1.0; }
|
||||
public function getLabelMarginRight() { return 1.0; }
|
||||
|
||||
public function getSupportAssetTag() { return true; }
|
||||
public function getSupport1DBarcode() { return false; }
|
||||
public function getSupport2DBarcode() { return true; }
|
||||
public function getSupportFields() { return 4; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
$titleShiftX = 0;
|
||||
|
||||
$barcodeSize = $pa->h - self::TAG_SIZE;
|
||||
|
||||
if ($record->has('barcode2d')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$pa->x1, $pa->y2 - self::TAG_SIZE,
|
||||
'freemono', 'b', self::TAG_SIZE, 'C',
|
||||
$barcodeSize, self::TAG_SIZE, true, 0
|
||||
);
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$pa->x1, $pa->y1,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
} else {
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$pa->x1, $pa->y1,
|
||||
'freemono', 'b', self::TITLE_SIZE, 'L',
|
||||
$barcodeSize, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
$titleShiftX = $barcodeSize;
|
||||
}
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$currentX + $titleShiftX, $currentY,
|
||||
'freesans', '', self::TITLE_SIZE, 'L',
|
||||
$usableWidth, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.3
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
103
app/Models/Labels/Sheets/Avery/L7162_B.php
Normal file
103
app/Models/Labels/Sheets/Avery/L7162_B.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class L7162_B extends L7162
|
||||
{
|
||||
private const BARCODE_SIZE = 6.00;
|
||||
private const BARCODE_MARGIN = 1.40;
|
||||
private const TAG_SIZE = 3.20;
|
||||
private const LOGO_MAX_WIDTH = 25.00;
|
||||
private const LOGO_MARGIN = 2.20;
|
||||
private const TITLE_SIZE = 4.20;
|
||||
private const TITLE_MARGIN = 1.20;
|
||||
private const LABEL_SIZE = 2.20;
|
||||
private const LABEL_MARGIN = - 0.50;
|
||||
private const FIELD_SIZE = 4.20;
|
||||
private const FIELD_MARGIN = 0.30;
|
||||
|
||||
public function getUnit() { return 'mm'; }
|
||||
|
||||
public function getLabelMarginTop() { return 1.0; }
|
||||
public function getLabelMarginBottom() { return 0; }
|
||||
public function getLabelMarginLeft() { return 1.0; }
|
||||
public function getLabelMarginRight() { return 1.0; }
|
||||
|
||||
public function getSupportAssetTag() { return true; }
|
||||
public function getSupport1DBarcode() { return true; }
|
||||
public function getSupport2DBarcode() { return false; }
|
||||
public function getSupportFields() { return 3; }
|
||||
public function getSupportLogo() { return true; }
|
||||
public function getSupportTitle() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
|
||||
if ($record->has('barcode1d')) {
|
||||
static::write1DBarcode(
|
||||
$pdf, $record->get('barcode1d')->content, $record->get('barcode1d')->type,
|
||||
$pa->x1, $pa->y2 - self::BARCODE_SIZE,
|
||||
$usableWidth, self::BARCODE_SIZE
|
||||
);
|
||||
$usableHeight -= self::BARCODE_SIZE + self::BARCODE_MARGIN;
|
||||
}
|
||||
|
||||
if ($record->has('logo')) {
|
||||
$logoSize = static::writeImage(
|
||||
$pdf, $record->get('logo'),
|
||||
$pa->x1, $pa->y1,
|
||||
self::LOGO_MAX_WIDTH, $usableHeight,
|
||||
'L', 'T', 300, true, false, 0.1
|
||||
);
|
||||
$currentX += $logoSize[0] + self::LOGO_MARGIN;
|
||||
$usableWidth -= $logoSize[0] + self::LOGO_MARGIN;
|
||||
}
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::TITLE_SIZE, 'L',
|
||||
$usableWidth, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.3
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$currentX, $pa->y2 - self::BARCODE_SIZE - self::BARCODE_MARGIN - self::TAG_SIZE,
|
||||
'freemono', 'b', self::TAG_SIZE, 'R',
|
||||
$usableWidth, self::TAG_SIZE, true, 0, 0.3
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
71
app/Models/Labels/Sheets/Avery/L7163.php
Normal file
71
app/Models/Labels/Sheets/Avery/L7163.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class L7163 extends RectangleSheet
|
||||
{
|
||||
|
||||
private const PAPER_FORMAT = 'A4';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
/* Data in pt from Word Template */
|
||||
private const COLUMN1_X = 13.25;
|
||||
private const COLUMN2_X = 301.25;
|
||||
private const ROW1_Y = 43.05;
|
||||
private const ROW2_Y = 151.05;
|
||||
private const LABEL_W = 280.80;
|
||||
private const LABEL_H = 108.00;
|
||||
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct() {
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
|
||||
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
|
||||
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
|
||||
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth() { return $this->pageWidth; }
|
||||
public function getPageHeight() { return $this->pageHeight; }
|
||||
|
||||
public function getPageMarginTop() { return $this->pageMarginTop; }
|
||||
public function getPageMarginBottom() { return $this->pageMarginTop; }
|
||||
public function getPageMarginLeft() { return $this->pageMarginLeft; }
|
||||
public function getPageMarginRight() { return $this->pageMarginLeft; }
|
||||
|
||||
public function getColumns() { return 2; }
|
||||
public function getRows() { return 7; }
|
||||
|
||||
public function getLabelColumnSpacing() { return $this->columnSpacing; }
|
||||
public function getLabelRowSpacing() { return $this->rowSpacing; }
|
||||
|
||||
public function getLabelWidth() { return $this->labelWidth; }
|
||||
public function getLabelHeight() { return $this->labelHeight; }
|
||||
|
||||
public function getLabelBorder() { return 0; }
|
||||
}
|
||||
|
||||
?>
|
||||
98
app/Models/Labels/Sheets/Avery/L7163_A.php
Normal file
98
app/Models/Labels/Sheets/Avery/L7163_A.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class L7163_A extends L7163
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.80;
|
||||
private const TAG_SIZE = 4.80;
|
||||
private const TITLE_SIZE = 5.00;
|
||||
private const TITLE_MARGIN = 1.80;
|
||||
private const LABEL_SIZE = 2.35;
|
||||
private const LABEL_MARGIN = - 0.30;
|
||||
private const FIELD_SIZE = 4.80;
|
||||
private const FIELD_MARGIN = 0.30;
|
||||
|
||||
public function getUnit() { return 'mm'; }
|
||||
|
||||
public function getLabelMarginTop() { return 1.0; }
|
||||
public function getLabelMarginBottom() { return 1.0; }
|
||||
public function getLabelMarginLeft() { return 1.0; }
|
||||
public function getLabelMarginRight() { return 1.0; }
|
||||
|
||||
public function getSupportAssetTag() { return true; }
|
||||
public function getSupport1DBarcode() { return false; }
|
||||
public function getSupport2DBarcode() { return true; }
|
||||
public function getSupportFields() { return 4; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::TITLE_SIZE, 'C',
|
||||
$usableWidth, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
}
|
||||
|
||||
$barcodeSize = $pa->h - self::TITLE_SIZE - self::TITLE_MARGIN - self::TAG_SIZE;
|
||||
|
||||
if ($record->has('barcode2d')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$pa->x1, $pa->y2 - self::TAG_SIZE,
|
||||
'freemono', 'b', self::TAG_SIZE, 'C',
|
||||
$barcodeSize, self::TAG_SIZE, true, 0
|
||||
);
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$pa->x1, $currentY,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
} else {
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$pa->x1, $pa->y2 - self::TAG_SIZE,
|
||||
'freemono', 'b', self::TAG_SIZE, 'R',
|
||||
$usableWidth, self::TAG_SIZE, true, 0
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.5
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
71
app/Models/Labels/Sheets/Avery/_5267.php
Normal file
71
app/Models/Labels/Sheets/Avery/_5267.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class _5267 extends RectangleSheet
|
||||
{
|
||||
|
||||
private const PAPER_FORMAT = 'LETTER';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
/* Data in pt from Word Template */
|
||||
private const COLUMN1_X = 21.60;
|
||||
private const COLUMN2_X = 169.20;
|
||||
private const ROW1_Y = 36.10;
|
||||
private const ROW2_Y = 72.10;
|
||||
private const LABEL_W = 126.00;
|
||||
private const LABEL_H = 36.00;
|
||||
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct() {
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 2);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
|
||||
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
|
||||
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
|
||||
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth() { return $this->pageWidth; }
|
||||
public function getPageHeight() { return $this->pageHeight; }
|
||||
|
||||
public function getPageMarginTop() { return $this->pageMarginTop; }
|
||||
public function getPageMarginBottom() { return $this->pageMarginTop; }
|
||||
public function getPageMarginLeft() { return $this->pageMarginLeft; }
|
||||
public function getPageMarginRight() { return $this->pageMarginLeft; }
|
||||
|
||||
public function getColumns() { return 4; }
|
||||
public function getRows() { return 20; }
|
||||
|
||||
public function getLabelColumnSpacing() { return $this->columnSpacing; }
|
||||
public function getLabelRowSpacing() { return $this->rowSpacing; }
|
||||
|
||||
public function getLabelWidth() { return $this->labelWidth; }
|
||||
public function getLabelHeight() { return $this->labelHeight; }
|
||||
|
||||
public function getLabelBorder() { return 0; }
|
||||
}
|
||||
|
||||
?>
|
||||
68
app/Models/Labels/Sheets/Avery/_5267_A.php
Normal file
68
app/Models/Labels/Sheets/Avery/_5267_A.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class _5267_A extends _5267
|
||||
{
|
||||
private const BARCODE_SIZE = 0.175;
|
||||
private const BARCODE_MARGIN = 0.000;
|
||||
private const TAG_SIZE = 0.125;
|
||||
private const TITLE_SIZE = 0.140;
|
||||
private const FIELD_SIZE = 0.150;
|
||||
private const FIELD_MARGIN = 0.012;
|
||||
|
||||
public function getUnit() { return 'in'; }
|
||||
|
||||
public function getLabelMarginTop() { return 0.02; }
|
||||
public function getLabelMarginBottom() { return 0.00; }
|
||||
public function getLabelMarginLeft() { return 0.04; }
|
||||
public function getLabelMarginRight() { return 0.04; }
|
||||
|
||||
public function getSupportAssetTag() { return false; }
|
||||
public function getSupport1DBarcode() { return true; }
|
||||
public function getSupport2DBarcode() { return false; }
|
||||
public function getSupportFields() { return 1; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
if ($record->has('barcode1d')) {
|
||||
static::write1DBarcode(
|
||||
$pdf, $record->get('barcode1d')->content, $record->get('barcode1d')->type,
|
||||
$pa->x1, $pa->y2 - self::BARCODE_SIZE,
|
||||
$pa->w, self::BARCODE_SIZE
|
||||
);
|
||||
}
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$pa->x1, $pa->y1,
|
||||
'freesans', '', self::TITLE_SIZE, 'L',
|
||||
$pa->w, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
}
|
||||
|
||||
$fieldY = $pa->y2 - self::BARCODE_SIZE - self::BARCODE_MARGIN - self::FIELD_SIZE;
|
||||
if ($record->has('fields')) {
|
||||
if ($record->get('fields')->count() >= 1) {
|
||||
$field = $record->get('fields')->first();
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$pa->x1, $fieldY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'C',
|
||||
$pa->w, self::FIELD_SIZE, true, 0, 0.01
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
71
app/Models/Labels/Sheets/Avery/_5520.php
Normal file
71
app/Models/Labels/Sheets/Avery/_5520.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class _5520 extends RectangleSheet
|
||||
{
|
||||
|
||||
private const PAPER_FORMAT = 'LETTER';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
/* Data in pt from Word Template */
|
||||
private const COLUMN1_X = 13.55;
|
||||
private const COLUMN2_X = 211.55;
|
||||
private const ROW1_Y = 36.10;
|
||||
private const ROW2_Y = 108.10;
|
||||
private const LABEL_W = 189.35;
|
||||
private const LABEL_H = 72.00;
|
||||
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct() {
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 2);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
|
||||
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
|
||||
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
|
||||
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth() { return $this->pageWidth; }
|
||||
public function getPageHeight() { return $this->pageHeight; }
|
||||
|
||||
public function getPageMarginTop() { return $this->pageMarginTop; }
|
||||
public function getPageMarginBottom() { return $this->pageMarginTop; }
|
||||
public function getPageMarginLeft() { return $this->pageMarginLeft; }
|
||||
public function getPageMarginRight() { return $this->pageMarginLeft; }
|
||||
|
||||
public function getColumns() { return 3; }
|
||||
public function getRows() { return 10; }
|
||||
|
||||
public function getLabelColumnSpacing() { return $this->columnSpacing; }
|
||||
public function getLabelRowSpacing() { return $this->rowSpacing; }
|
||||
|
||||
public function getLabelWidth() { return $this->labelWidth; }
|
||||
public function getLabelHeight() { return $this->labelHeight; }
|
||||
|
||||
public function getLabelBorder() { return 0; }
|
||||
}
|
||||
|
||||
?>
|
||||
85
app/Models/Labels/Sheets/Avery/_5520_A.php
Normal file
85
app/Models/Labels/Sheets/Avery/_5520_A.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class _5520_A extends _5520
|
||||
{
|
||||
private const BARCODE_MARGIN = 0.075;
|
||||
private const TAG_SIZE = 0.125;
|
||||
private const TITLE_SIZE = 0.140;
|
||||
private const TITLE_MARGIN = 0.040;
|
||||
private const LABEL_SIZE = 0.090;
|
||||
private const LABEL_MARGIN = -0.015;
|
||||
private const FIELD_SIZE = 0.150;
|
||||
private const FIELD_MARGIN = 0.012;
|
||||
|
||||
public function getUnit() { return 'in'; }
|
||||
|
||||
public function getLabelMarginTop() { return 0.06; }
|
||||
public function getLabelMarginBottom() { return 0.06; }
|
||||
public function getLabelMarginLeft() { return 0.06; }
|
||||
public function getLabelMarginRight() { return 0.06; }
|
||||
|
||||
public function getSupportAssetTag() { return false; }
|
||||
public function getSupport1DBarcode() { return false; }
|
||||
public function getSupport2DBarcode() { return true; }
|
||||
public function getSupportFields() { return 3; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$pa->x1, $pa->y1,
|
||||
'freesans', '', self::TITLE_SIZE, 'C',
|
||||
$pa->w, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
}
|
||||
|
||||
$barcodeSize = $usableHeight;
|
||||
if ($record->has('barcode2d')) {
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$currentX, $currentY,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.01
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
19
app/Models/Labels/Tapes/Brother/TZe_12mm.php
Normal file
19
app/Models/Labels/Tapes/Brother/TZe_12mm.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Tapes\Brother;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\Label;
|
||||
|
||||
abstract class TZe_12mm extends Label
|
||||
{
|
||||
private const HEIGHT = 12.00;
|
||||
private const MARGIN_SIDES = 3.20;
|
||||
private const MARGIN_ENDS = 3.20;
|
||||
|
||||
public function getHeight() { return Helper::convertUnit(self::HEIGHT, 'mm', $this->getUnit()); }
|
||||
public function getMarginTop() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit()); }
|
||||
public function getMarginBottom() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit());}
|
||||
public function getMarginLeft() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); }
|
||||
public function getMarginRight() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); }
|
||||
}
|
||||
56
app/Models/Labels/Tapes/Brother/TZe_12mm_A.php
Normal file
56
app/Models/Labels/Tapes/Brother/TZe_12mm_A.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Tapes\Brother;
|
||||
|
||||
class TZe_12mm_A extends TZe_12mm
|
||||
{
|
||||
private const BARCODE_SIZE = 3.20;
|
||||
private const BARCODE_MARGIN = 0.30;
|
||||
private const TEXT_SIZE_MOD = 1.00;
|
||||
|
||||
public function getUnit() { return 'mm'; }
|
||||
public function getWidth() { return 50.0; }
|
||||
public function getSupportAssetTag() { return true; }
|
||||
public function getSupport1DBarcode() { return true; }
|
||||
public function getSupport2DBarcode() { return false; }
|
||||
public function getSupportFields() { return 1; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return false; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getPrintableArea();
|
||||
|
||||
if ($record->has('barcode1d')) {
|
||||
static::write1DBarcode(
|
||||
$pdf, $record->get('barcode1d')->content, $record->get('barcode1d')->type,
|
||||
$pa->x1, $pa->y1, $pa->w, self::BARCODE_SIZE
|
||||
);
|
||||
}
|
||||
|
||||
$currentY = $pa->y1 + self::BARCODE_SIZE + self::BARCODE_MARGIN;
|
||||
$usableHeight = $pa->h - self::BARCODE_SIZE - self::BARCODE_MARGIN;
|
||||
$fontSize = $usableHeight + self::TEXT_SIZE_MOD;
|
||||
|
||||
$tagWidth = $pa->w / 3;
|
||||
$fieldWidth = $pa->w / 3 * 2;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$pa->x1, $currentY,
|
||||
'freemono', 'b', $fontSize, 'L',
|
||||
$tagWidth, $usableHeight, true, 0, 0
|
||||
);
|
||||
|
||||
if ($record->get('fields')->count() >= 1) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('fields')->values()->get(0)['value'],
|
||||
$pa->x1 + ($tagWidth), $currentY,
|
||||
'freemono', 'b', $fontSize, 'R',
|
||||
$fieldWidth, $usableHeight, true, 0, 0
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
19
app/Models/Labels/Tapes/Brother/TZe_24mm.php
Normal file
19
app/Models/Labels/Tapes/Brother/TZe_24mm.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Tapes\Brother;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\Label;
|
||||
|
||||
abstract class TZe_24mm extends Label
|
||||
{
|
||||
private const HEIGHT = 24.00;
|
||||
private const MARGIN_SIDES = 3.20;
|
||||
private const MARGIN_ENDS = 3.20;
|
||||
|
||||
public function getHeight() { return Helper::convertUnit(self::HEIGHT, 'mm', $this->getUnit()); }
|
||||
public function getMarginTop() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit()); }
|
||||
public function getMarginBottom() { return Helper::convertUnit(self::MARGIN_SIDES, 'mm', $this->getUnit());}
|
||||
public function getMarginLeft() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); }
|
||||
public function getMarginRight() { return Helper::convertUnit(self::MARGIN_ENDS, 'mm', $this->getUnit()); }
|
||||
}
|
||||
87
app/Models/Labels/Tapes/Brother/TZe_24mm_A.php
Normal file
87
app/Models/Labels/Tapes/Brother/TZe_24mm_A.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Tapes\Brother;
|
||||
|
||||
class TZe_24mm_A extends TZe_24mm
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.40;
|
||||
private const TAG_SIZE = 2.80;
|
||||
private const TITLE_SIZE = 2.80;
|
||||
private const TITLE_MARGIN = 0.50;
|
||||
private const LABEL_SIZE = 2.00;
|
||||
private const LABEL_MARGIN = - 0.35;
|
||||
private const FIELD_SIZE = 3.20;
|
||||
private const FIELD_MARGIN = 0.15;
|
||||
|
||||
public function getUnit() { return 'mm'; }
|
||||
public function getWidth() { return 65.0; }
|
||||
public function getSupportAssetTag() { return true; }
|
||||
public function getSupport1DBarcode() { return false; }
|
||||
public function getSupport2DBarcode() { return true; }
|
||||
public function getSupportFields() { return 3; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return true; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record) {
|
||||
$pa = $this->getPrintableArea();
|
||||
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
$usableWidth = $pa->w;
|
||||
|
||||
$barcodeSize = $pa->h - self::TAG_SIZE;
|
||||
|
||||
if ($record->has('barcode2d')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$pa->x1, $pa->y2 - self::TAG_SIZE,
|
||||
'freemono', 'b', self::TAG_SIZE, 'C',
|
||||
$barcodeSize, self::TAG_SIZE, true, 0
|
||||
);
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$currentX, $currentY,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
} else {
|
||||
static::writeText(
|
||||
$pdf, $record->get('tag'),
|
||||
$pa->x1, $pa->y2 - self::TAG_SIZE,
|
||||
'freemono', 'b', self::TAG_SIZE, 'R',
|
||||
$usableWidth, self::TAG_SIZE, true, 0
|
||||
);
|
||||
}
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::TITLE_SIZE, 'L',
|
||||
$usableWidth, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.3
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ class Location extends SnipeModel
|
||||
'state',
|
||||
'country',
|
||||
'zip',
|
||||
'phone',
|
||||
'fax',
|
||||
'ldap_ou',
|
||||
'currency',
|
||||
'manager_id',
|
||||
@@ -80,7 +82,7 @@ class Location extends SnipeModel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at', 'ldap_ou'];
|
||||
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at', 'ldap_ou', 'phone', 'fax'];
|
||||
|
||||
/**
|
||||
* The relations and their attributes that should be included when searching the model.
|
||||
|
||||
@@ -71,12 +71,33 @@ class AssetObserver
|
||||
public function created(Asset $asset)
|
||||
{
|
||||
if ($settings = Setting::getSettings()) {
|
||||
$settings->increment('next_auto_tag_base');
|
||||
$settings->save();
|
||||
$tag = $asset->asset_tag;
|
||||
$prefix = $settings->auto_increment_prefix;
|
||||
$number = substr($tag, strlen($prefix));
|
||||
// IF - auto_increment_assets is on, AND (the prefix matches the start of the tag OR there is no prefix)
|
||||
// AND the rest of the string after the prefix is all digits, THEN...
|
||||
if ($settings->auto_increment_assets && (strpos($tag, $prefix) === 0 || $prefix=='') && preg_match('/\d+/',$number) === 1) {
|
||||
// new way of auto-trueing-up auto_increment ID's
|
||||
$next_asset_tag = intval($number, 10) + 1;
|
||||
// we had to use 'intval' because the $number could be '01234' and
|
||||
// might get interpreted in Octal instead of decimal
|
||||
|
||||
// only modify the 'next' one if it's *bigger* than the stored base
|
||||
//
|
||||
if($next_asset_tag > $settings->next_auto_tag_base) {
|
||||
$settings->next_auto_tag_base = $next_asset_tag;
|
||||
$settings->save();
|
||||
}
|
||||
|
||||
} else {
|
||||
// legacy method
|
||||
$settings->increment('next_auto_tag_base');
|
||||
$settings->save();
|
||||
}
|
||||
}
|
||||
|
||||
$logAction = new Actionlog();
|
||||
$logAction->item_type = Asset::class;
|
||||
$logAction->item_type = Asset::class; // can we instead say $logAction->item = $asset ?
|
||||
$logAction->item_id = $asset->id;
|
||||
$logAction->created_at = date('Y-m-d H:i:s');
|
||||
$logAction->user_id = Auth::id();
|
||||
|
||||
@@ -123,6 +123,7 @@ class AssetModelPresenter extends Presenter
|
||||
'switchable' => true,
|
||||
'title' => trans('general.notes'),
|
||||
'visible' => false,
|
||||
'formatter' => 'notesFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'created_at',
|
||||
|
||||
@@ -154,6 +154,13 @@ class AssetPresenter extends Presenter
|
||||
'footerFormatter' => 'sumFormatter',
|
||||
'class' => 'text-right',
|
||||
], [
|
||||
"field" => "book_value",
|
||||
"searchable" => false,
|
||||
"sortable" => false,
|
||||
"title" => trans('admin/hardware/table.book_value'),
|
||||
"footerFormatter" => 'sumFormatter',
|
||||
"class" => "text-right",
|
||||
],[
|
||||
'field' => 'order_number',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
@@ -292,7 +299,7 @@ class AssetPresenter extends Presenter
|
||||
'formatter'=> 'customFieldsFormatter',
|
||||
'escape' => true,
|
||||
'class' => ($field->field_encrypted == '1') ? 'css-padlock' : '',
|
||||
'visible' => true,
|
||||
'visible' => ($field->show_in_listview == '1') ? true : false,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,30 @@ class CompanyPresenter extends Presenter
|
||||
'title' => trans('admin/companies/table.name'),
|
||||
'visible' => true,
|
||||
'formatter' => 'companiesLinkFormatter',
|
||||
], [
|
||||
'field' => 'phone',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/users/table.phone'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
], [
|
||||
'field' => 'fax',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/suppliers/table.fax'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
], [
|
||||
'field' => 'email',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/suppliers/table.email'),
|
||||
'visible' => true,
|
||||
'formatter' => 'emailFormatter',
|
||||
], [
|
||||
'field' => 'image',
|
||||
'searchable' => false,
|
||||
|
||||
96
app/Presenters/LabelPresenter.php
Normal file
96
app/Presenters/LabelPresenter.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Presenters;
|
||||
|
||||
/**
|
||||
* Class LabelPresenter
|
||||
*/
|
||||
class LabelPresenter extends Presenter
|
||||
{
|
||||
/**
|
||||
* Json Column Layout for bootstrap table
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTableLayout()
|
||||
{
|
||||
$layout = [
|
||||
[
|
||||
'field' => 'radio',
|
||||
'radio' => true,
|
||||
'formatter' => 'labelRadioFormatter'
|
||||
], [
|
||||
'field' => 'name',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('general.name'),
|
||||
'visible' => true,
|
||||
], [
|
||||
'field' => 'size',
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/settings/table.size'),
|
||||
'visible' => true,
|
||||
'formatter' => 'labelSizeFormatter'
|
||||
], [
|
||||
'field' => 'labels_per_page',
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/labels/table.labels_per_page'),
|
||||
'visible' => true,
|
||||
'formatter' => 'labelPerPageFormatter'
|
||||
], [
|
||||
'field' => 'support_fields',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/labels/table.support_fields'),
|
||||
'visible' => true
|
||||
], [
|
||||
'field' => 'support_asset_tag',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/labels/table.support_asset_tag'),
|
||||
'visible' => true,
|
||||
'formatter' => 'trueFalseFormatter'
|
||||
], [
|
||||
'field' => 'support_1d_barcode',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/labels/table.support_1d_barcode'),
|
||||
'visible' => true,
|
||||
'formatter' => 'trueFalseFormatter'
|
||||
], [
|
||||
'field' => 'support_2d_barcode',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/labels/table.support_2d_barcode'),
|
||||
'visible' => true,
|
||||
'formatter' => 'trueFalseFormatter'
|
||||
], [
|
||||
'field' => 'support_logo',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/labels/table.support_logo'),
|
||||
'visible' => true,
|
||||
'formatter' => 'trueFalseFormatter'
|
||||
], [
|
||||
'field' => 'support_title',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/labels/table.support_title'),
|
||||
'visible' => true,
|
||||
'formatter' => 'trueFalseFormatter'
|
||||
]
|
||||
];
|
||||
|
||||
return json_encode($layout);
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,24 @@ class LocationPresenter extends Presenter
|
||||
'title' => trans('admin/locations/table.country'),
|
||||
'visible' => false,
|
||||
],
|
||||
[
|
||||
'field' => 'phone',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/users/table.phone'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'fax',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/suppliers/table.fax'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'ldap_ou',
|
||||
'searchable' => true,
|
||||
|
||||
@@ -146,6 +146,11 @@ class AuthServiceProvider extends ServiceProvider
|
||||
}
|
||||
});
|
||||
|
||||
Gate::define('assets.view.encrypted_custom_fields', function ($user) {
|
||||
if($user->hasAccess('assets.view.encrypted_custom_fields')){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------------------------------
|
||||
// Reports
|
||||
|
||||
226
app/View/Label.php
Normal file
226
app/View/Label.php
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
|
||||
namespace App\View;
|
||||
|
||||
use App\Models\Labels\Field;
|
||||
use App\Models\Labels\Label as LabelModel;
|
||||
use App\Models\Labels\Sheet;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use TCPDF;
|
||||
|
||||
class Label implements View
|
||||
{
|
||||
use Macroable { __call as macroCall; }
|
||||
|
||||
protected const NAME = 'label';
|
||||
|
||||
/**
|
||||
* A Collection of passed data.
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
public function __construct() {
|
||||
$this->data = new Collection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the PDF label.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
*/
|
||||
public function render(callable $callback = null)
|
||||
{
|
||||
$settings = $this->data->get('settings');
|
||||
$assets = $this->data->get('assets');
|
||||
$offset = $this->data->get('offset');
|
||||
$template = $this->data->get('template');
|
||||
|
||||
// If disabled, pass to legacy view
|
||||
if ((!$settings->label2_enable) && (!$template)) {
|
||||
return view('hardware/labels')
|
||||
->with('assets', $assets)
|
||||
->with('settings', $settings)
|
||||
->with('bulkedit', $this->data->get('bulkedit'))
|
||||
->with('count', $this->data->get('count'));
|
||||
}
|
||||
|
||||
// If a specific template was set, use it, otherwise fall back to default
|
||||
if (empty($template)) {
|
||||
$template = LabelModel::find($settings->label2_template);
|
||||
} elseif (is_string($template)) {
|
||||
$template = LabelModel::find($template);
|
||||
}
|
||||
|
||||
$template->validate();
|
||||
|
||||
$pdf = new TCPDF(
|
||||
$template->getOrientation(),
|
||||
$template->getUnit(),
|
||||
[ $template->getWidth(), $template->getHeight() ]
|
||||
);
|
||||
|
||||
// Reset parameters
|
||||
$pdf->SetPrintHeader(false);
|
||||
$pdf->SetPrintFooter(false);
|
||||
$pdf->SetAutoPageBreak(false);
|
||||
$pdf->SetMargins(0, 0, null, true);
|
||||
$pdf->SetCellMargins(0, 0, 0, 0);
|
||||
$pdf->SetCellPaddings(0, 0, 0, 0);
|
||||
$pdf->setCreator('Snipe-IT');
|
||||
$pdf->SetSubject('Asset Labels');
|
||||
$template->preparePDF($pdf);
|
||||
|
||||
// Get fields from settings
|
||||
$fieldDefinitions = collect(explode(';', $settings->label2_fields))
|
||||
->filter(fn($fieldString) => !empty($fieldString))
|
||||
->map(fn($fieldString) => Field::fromString($fieldString));
|
||||
|
||||
// Prepare data
|
||||
$data = $assets
|
||||
->map(function ($asset) use ($template, $settings, $fieldDefinitions) {
|
||||
|
||||
$assetData = new Collection();
|
||||
|
||||
$assetData->put('asset', $asset);
|
||||
$assetData->put('id', $asset->id);
|
||||
$assetData->put('tag', $asset->asset_tag);
|
||||
|
||||
if ($template->getSupportTitle()) {
|
||||
|
||||
if ($asset->company && !empty($settings->label2_title)) {
|
||||
$title = str_replace('{COMPANY}', $asset->company->name, $settings->label2_title);
|
||||
$settings->qr_text;
|
||||
$assetData->put('title', $title);
|
||||
}
|
||||
}
|
||||
|
||||
if ($template->getSupportLogo()) {
|
||||
|
||||
$logo = null;
|
||||
|
||||
// Should we be trying to use a logo at all?
|
||||
if ($settings->label2_asset_logo='1') {
|
||||
|
||||
// If we don't have a company image, fall back to the general site label image
|
||||
if (!empty($settings->label_logo)) {
|
||||
$logo = Storage::disk('public')->path('/'.e($settings->label_logo));
|
||||
}
|
||||
|
||||
// If we have a company logo, use that first
|
||||
if (($asset->company) && ($asset->company->image!='')) {
|
||||
$logo = Storage::disk('public')->path('companies/'.e($asset->company->image));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty($logo)) {
|
||||
$assetData->put('logo', $logo);
|
||||
}
|
||||
}
|
||||
|
||||
if ($template->getSupport1DBarcode()) {
|
||||
$barcode1DType = $settings->label2_1d_type;
|
||||
$barcode1DType = ($barcode1DType == 'default') ?
|
||||
(($settings->alt_barcode_enabled) ? $settings->alt_barcode : null) :
|
||||
$barcode1DType;
|
||||
if ($barcode1DType != 'none') {
|
||||
$assetData->put('barcode1d', (object)[
|
||||
'type' => $barcode1DType,
|
||||
'content' => $asset->asset_tag,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($template->getSupport2DBarcode()) {
|
||||
$barcode2DType = $settings->label2_2d_type;
|
||||
$barcode2DType = ($barcode2DType == 'default') ?
|
||||
$settings->barcode_type :
|
||||
$barcode2DType;
|
||||
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
|
||||
switch ($settings->label2_2d_target) {
|
||||
case 'ht_tag': $barcode2DTarget = route('ht/assetTag', $asset->asset_tag); break;
|
||||
case 'hardware_id':
|
||||
default: $barcode2DTarget = route('hardware.show', $asset->id); break;
|
||||
}
|
||||
$assetData->put('barcode2d', (object)[
|
||||
'type' => $barcode2DType,
|
||||
'content' => $barcode2DTarget,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$fields = $fieldDefinitions
|
||||
->map(fn($field) => $field->toArray($asset))
|
||||
->filter(fn($field) => $field != null)
|
||||
->reduce(function($myFields, $field) {
|
||||
// Remove Duplicates
|
||||
$toAdd = $field
|
||||
->filter(fn($o) => !$myFields->contains('dataSource', $o['dataSource']))
|
||||
->first();
|
||||
|
||||
return $toAdd ? $myFields->push($toAdd) : $myFields;
|
||||
}, new Collection());
|
||||
|
||||
$assetData->put('fields', $fields->take($template->getSupportFields()));
|
||||
|
||||
return $assetData;
|
||||
});
|
||||
|
||||
if ($template instanceof Sheet) {
|
||||
$template->setLabelIndexOffset($offset ?? 0);
|
||||
}
|
||||
$template->writeAll($pdf, $data);
|
||||
|
||||
$filename = $assets->count() > 1 ? 'assets.pdf' : $assets->first()->asset_tag.'.pdf';
|
||||
$pdf->Output($filename, 'I');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a piece of data.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function with($key, $value = null)
|
||||
{
|
||||
$this->data->put($key, $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of view data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the view.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function name()
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the view.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return self::NAME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,7 +50,7 @@
|
||||
"laravel/tinker": "^2.6",
|
||||
"laravel/ui": "^3.3",
|
||||
"laravelcollective/html": "^6.2",
|
||||
"lcobucci/clock": "1.2.0|2.0.0",
|
||||
"lcobucci/clock": "^1.2.0|^2.0.0",
|
||||
"lcobucci/jwt": "^3.4.5|^4.0.4",
|
||||
"league/csv": "^9.7",
|
||||
"league/flysystem-aws-s3-v3": "^1.0",
|
||||
@@ -70,6 +70,7 @@
|
||||
"spatie/laravel-backup": "^6.16",
|
||||
"symfony/polyfill-mbstring": "^1.22",
|
||||
"tecnickcom/tc-lib-barcode": "^1.15",
|
||||
"tecnickcom/tcpdf": "^6.5",
|
||||
"unicodeveloper/laravel-password": "^1.0",
|
||||
"watson/validating": "^6.1"
|
||||
},
|
||||
@@ -85,7 +86,7 @@
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"symfony/css-selector": "^4.4",
|
||||
"symfony/dom-crawler": "^4.4",
|
||||
"vimeo/psalm": "^5.6"
|
||||
"vimeo/psalm": "^5.13"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
|
||||
578
composer.lock
generated
578
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -132,4 +132,16 @@ return [
|
||||
|
||||
'password_timeout' => env('PASSWORD_CONFIRM_TIMEOUT', 10800),
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login form autocomplete
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determine whether to include autocomplete="off" on the login form. Some users may want to disable
|
||||
| autocomplete for compliance with security requirements.
|
||||
|
|
||||
*/
|
||||
'login_autocomplete' => env('LOGIN_AUTOCOMPLETE', false),
|
||||
|
||||
];
|
||||
|
||||
@@ -106,6 +106,13 @@ return [
|
||||
'display' => true,
|
||||
],
|
||||
|
||||
[
|
||||
'permission' => 'assets.view.encrypted_custom_fields',
|
||||
'label' => 'View and Modify Encrypted Custom Fields',
|
||||
'note' => '',
|
||||
'display' => true,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'Accessories' => [
|
||||
|
||||
@@ -25,6 +25,7 @@ return [
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
],
|
||||
|
||||
'mandrill' => [
|
||||
|
||||
@@ -158,4 +158,20 @@ return [
|
||||
|
||||
'secure' => env('SECURE_COOKIES', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bootstrap Table Storage Type
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set the storage that this Bootstrap Table will use.
|
||||
| Valid options are:
|
||||
| - cookieStorage
|
||||
| - localStorage: use this if you have a LOT of custom fields and are getting a REQUEST TOO LARGE error
|
||||
| - sessionStorage
|
||||
|
|
||||
| More info: https://bootstrap-table.com/docs/extensions/cookie/#cookiestorage
|
||||
*/
|
||||
|
||||
'bs_table_storage' => env('BS_TABLE_STORAGE', 'cookieStorage'),
|
||||
|
||||
];
|
||||
|
||||
@@ -30,7 +30,7 @@ class UserFactory extends Factory
|
||||
'locale' => 'en',
|
||||
'notes' => 'Created by DB seeder',
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'permissions' => '{"user":"0"}',
|
||||
'permissions' => '{}',
|
||||
'phone' => $this->faker->phoneNumber(),
|
||||
'state' => $this->faker->stateAbbr(),
|
||||
'username' => $this->faker->username(),
|
||||
@@ -81,11 +81,7 @@ class UserFactory extends Factory
|
||||
|
||||
public function superuser()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"superuser":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['superuser' => '1']);
|
||||
}
|
||||
|
||||
public function admin()
|
||||
@@ -102,326 +98,205 @@ class UserFactory extends Factory
|
||||
|
||||
public function viewAssets()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"assets.view":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['assets.view' => '1']);
|
||||
}
|
||||
|
||||
public function createAssets()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"assets.create":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['assets.create' => '1']);
|
||||
}
|
||||
|
||||
public function editAssets()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"assets.edit":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['assets.edit' => '1']);
|
||||
}
|
||||
|
||||
public function deleteAssets()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"assets.delete":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['assets.delete' => '1']);
|
||||
}
|
||||
|
||||
public function checkinAssets()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"assets.checkin":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['assets.checkin' => '1']);
|
||||
}
|
||||
|
||||
public function checkoutAssets()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"assets.checkout":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['assets.checkout' => '1']);
|
||||
}
|
||||
|
||||
public function viewRequestableAssets()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"assets.view.requestable":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['assets.view.requestable' => '1']);
|
||||
}
|
||||
|
||||
public function viewAccessories()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"accessories.view":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['accessories.view' => '1']);
|
||||
}
|
||||
|
||||
public function createAccessories()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"accessories.create":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['accessories.create' => '1']);
|
||||
}
|
||||
|
||||
public function editAccessories()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"accessories.edit":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['accessories.edit' => '1']);
|
||||
}
|
||||
|
||||
public function deleteAccessories()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"accessories.delete":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['accessories.delete' => '1']);
|
||||
}
|
||||
|
||||
public function checkinAccessories()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"accessories.checkin":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['accessories.checkin' => '1']);
|
||||
}
|
||||
|
||||
public function checkoutAccessories()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"accessories.checkout":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['accessories.checkout' => '1']);
|
||||
}
|
||||
|
||||
public function viewConsumables()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"consumables.view":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['consumables.view' => '1']);
|
||||
}
|
||||
|
||||
public function createConsumables()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"consumables.create":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['consumables.create' => '1']);
|
||||
}
|
||||
|
||||
public function editConsumables()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"consumables.edit":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['consumables.edit' => '1']);
|
||||
}
|
||||
|
||||
public function deleteConsumables()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"consumables.delete":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['consumables.delete' => '1']);
|
||||
}
|
||||
|
||||
public function checkinConsumables()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"consumables.checkin":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['consumables.checkin' => '1']);
|
||||
}
|
||||
|
||||
public function checkoutConsumables()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"consumables.checkout":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['consumables.checkout' => '1']);
|
||||
}
|
||||
|
||||
public function viewDepartments()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"departments.view":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['departments.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewLicenses()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"licenses.view":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['licenses.view' => '1']);
|
||||
}
|
||||
|
||||
public function createLicenses()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"licenses.create":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['licenses.create' => '1']);
|
||||
}
|
||||
|
||||
public function editLicenses()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"licenses.edit":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['licenses.edit' => '1']);
|
||||
}
|
||||
|
||||
public function deleteLicenses()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"licenses.delete":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['licenses.delete' => '1']);
|
||||
}
|
||||
|
||||
public function checkoutLicenses()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"licenses.checkout":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['licenses.checkout' => '1']);
|
||||
}
|
||||
|
||||
public function viewKeysLicenses()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"licenses.keys":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['licenses.keys' => '1']);
|
||||
}
|
||||
|
||||
public function viewComponents()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"components.view":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['components.view' => '1']);
|
||||
}
|
||||
|
||||
public function createComponents()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"components.create":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['components.create' => '1']);
|
||||
}
|
||||
|
||||
public function editComponents()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"components.edit":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['components.edit' => '1']);
|
||||
}
|
||||
|
||||
public function deleteComponents()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"components.delete":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['components.delete' => '1']);
|
||||
}
|
||||
|
||||
public function checkinComponents()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"components.checkin":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['components.checkin' => '1']);
|
||||
}
|
||||
|
||||
public function checkoutComponents()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"components.checkout":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['components.checkout' => '1']);
|
||||
}
|
||||
|
||||
public function viewUsers()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"users.view":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['users.view' => '1']);
|
||||
}
|
||||
|
||||
public function createUsers()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"users.create":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['users.create' => '1']);
|
||||
}
|
||||
|
||||
public function editUsers()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'permissions' => '{"users.edit":"1"}',
|
||||
];
|
||||
});
|
||||
return $this->appendPermission(['users.edit' => '1']);
|
||||
}
|
||||
|
||||
public function deleteUsers()
|
||||
{
|
||||
return $this->state(function () {
|
||||
return $this->appendPermission(['users.delete' => '1']);
|
||||
}
|
||||
|
||||
public function canEditOwnLocation()
|
||||
{
|
||||
return $this->appendPermission(['self.edit_location' => '1']);
|
||||
}
|
||||
|
||||
public function canViewReports()
|
||||
{
|
||||
return $this->appendPermission(['reports.view' => '1']);
|
||||
}
|
||||
|
||||
private function appendPermission(array $permission)
|
||||
{
|
||||
return $this->state(function ($currentState) use ($permission) {
|
||||
return [
|
||||
'permissions' => '{"users.delete":"1"}',
|
||||
'permissions' => json_encode(
|
||||
array_merge(
|
||||
json_decode($currentState['permissions'], true),
|
||||
$permission
|
||||
)
|
||||
),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddLabel2Settings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->boolean('label2_enable')->default(false);
|
||||
$table->string('label2_template')->nullable()->default('DefaultLabel');
|
||||
$table->string('label2_title')->nullable()->default(null);
|
||||
$table->boolean('label2_asset_logo')->default(false);
|
||||
$table->string('label2_1d_type')->default('default');
|
||||
$table->string('label2_2d_type')->default('default');
|
||||
$table->string('label2_2d_target')->default('hardware_id');
|
||||
$table->string('label2_fields')->default(
|
||||
trans('admin/hardware/form.name').'=name;'.
|
||||
trans('admin/hardware/form.serial').'=serial;'.
|
||||
trans('admin/hardware/form.model').'=model.name;'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'label2_enable')) $table->dropColumn('label2_enable');
|
||||
if (Schema::hasColumn('settings', 'label2_template')) $table->dropColumn('label2_template');
|
||||
if (Schema::hasColumn('settings', 'label2_title')) $table->dropColumn('label2_title');
|
||||
if (Schema::hasColumn('settings', 'label2_asset_logo')) $table->dropColumn('label2_asset_logo');
|
||||
if (Schema::hasColumn('settings', 'label2_1d_type')) $table->dropColumn('label2_1d_type');
|
||||
if (Schema::hasColumn('settings', 'label2_2d_type')) $table->dropColumn('label2_2d_type');
|
||||
if (Schema::hasColumn('settings', 'label2_2d_target')) $table->dropColumn('label2_2d_target');
|
||||
if (Schema::hasColumn('settings', 'label2_fields')) $table->dropColumn('label2_fields');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeSettingsTableIncreaseSamlIdpMetadataSize extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* This migration changes the format of the saml_idp_metadata field to MEDIUMTEXT
|
||||
* to avoid truncating
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->mediumText('saml_idp_metadata')->nullable()->default(null)->change();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->text('saml_idp_metadata')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPhoneFaxToLocations extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('locations', function (Blueprint $table) {
|
||||
$table->string('phone', 20)->after('zip')->nullable()->default(null);
|
||||
$table->string('fax', 20)->after('zip')->nullable()->default(null);
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->string('phone', 20)->after('name')->nullable()->default(null);
|
||||
$table->string('fax', 20)->after('name')->nullable()->default(null);
|
||||
});
|
||||
|
||||
Schema::table('departments', function (Blueprint $table) {
|
||||
$table->string('phone', 20)->after('name')->nullable()->default(null);
|
||||
$table->string('fax', 20)->after('name')->nullable()->default(null);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('locations', function (Blueprint $table) {
|
||||
$table->dropColumn('phone');
|
||||
$table->dropColumn('fax');
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->dropColumn('phone');
|
||||
$table->dropColumn('fax');
|
||||
});
|
||||
|
||||
Schema::table('departments', function (Blueprint $table) {
|
||||
$table->dropColumn('phone');
|
||||
$table->dropColumn('fax');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddShowInListViewToCustomFields extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('custom_fields', function (Blueprint $table) {
|
||||
$table->boolean('show_in_listview')->nullable()->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_fields', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('custom_fields', 'show_in_listview')) {
|
||||
$table->dropColumn('show_in_listview');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeWebhookSettingsVariableType extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->text('webhook_endpoint')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->varchar('webhook_endpoint')->change();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEmailToCompanies extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->string('email', 150)->after('fax')->nullable()->default(null);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->dropColumn('email');
|
||||
});
|
||||
}
|
||||
}
|
||||
249
package-lock.json
generated
249
package-lock.json
generated
@@ -1354,9 +1354,9 @@
|
||||
"integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ=="
|
||||
},
|
||||
"@jridgewell/source-map": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz",
|
||||
"integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==",
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz",
|
||||
"integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==",
|
||||
"requires": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
@@ -1431,9 +1431,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
|
||||
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz",
|
||||
"integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1565,9 +1565,9 @@
|
||||
}
|
||||
},
|
||||
"@types/eslint": {
|
||||
"version": "8.40.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.40.0.tgz",
|
||||
"integrity": "sha512-nbq2mvc/tBrK9zQQuItvjJl++GTN5j06DaPtp3hZCpngmG6Q3xoyEmd0TwZI0gAy/G1X0zhGBbr2imsGFdFV0g==",
|
||||
"version": "8.44.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz",
|
||||
"integrity": "sha512-sdPRb9K6iL5XZOmBubg8yiFp5yS/JdUDQsq5e6h95km91MCYMuvp7mh1fjPEYUhvHepKpZOjnEaMBR4PxjWDzg==",
|
||||
"requires": {
|
||||
"@types/estree": "*",
|
||||
"@types/json-schema": "*"
|
||||
@@ -2065,9 +2065,9 @@
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "8.8.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw=="
|
||||
"version": "8.10.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
|
||||
"integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw=="
|
||||
},
|
||||
"acorn-import-assertions": {
|
||||
"version": "1.9.0",
|
||||
@@ -2215,6 +2215,15 @@
|
||||
"picomatch": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"array-buffer-byte-length": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz",
|
||||
"integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"is-array-buffer": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"array-filter": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz",
|
||||
@@ -3154,9 +3163,9 @@
|
||||
"integrity": "sha1-EQPWvADPv6jPyaJZmrUYxVZD2j8="
|
||||
},
|
||||
"bootstrap-table": {
|
||||
"version": "1.21.4",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.21.4.tgz",
|
||||
"integrity": "sha512-Vp0kwkCsZzBINiA1KJ46LSkIa4oA0r6GSuzERZEqkUU8/0JDij2aG4CdYxiOm/UFCPZ9+KuAE4zSjxJLxg5jWw=="
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.22.1.tgz",
|
||||
"integrity": "sha512-Nw8p+BmaiMDSfoer/p49YeI3vJQAWhudxhyKMuqnJBb3NRvCRewMk7JDgiN9SQO3YeSejOirKtcdWpM0dtddWg=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
@@ -3555,9 +3564,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": {
|
||||
"version": "3.29.1",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.29.1.tgz",
|
||||
"integrity": "sha512-+jwgnhg6cQxKYIIjGtAHq2nwUOolo9eoFZ4sHfUH09BLXBgxnH4gA0zEd+t+BO2cNB8idaBtZFcFTRjQJRJmAw==",
|
||||
"version": "3.32.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.0.tgz",
|
||||
"integrity": "sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww==",
|
||||
"optional": true
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
@@ -4350,15 +4359,16 @@
|
||||
}
|
||||
},
|
||||
"deep-equal": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.0.tgz",
|
||||
"integrity": "sha512-RdpzE0Hv4lhowpIUKKMJfeH6C1pXdtT1/it80ubgWqwI3qpuxUBpC1S4hnHg+zjnuOoDkzUtUCEEkG+XG5l3Mw==",
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz",
|
||||
"integrity": "sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==",
|
||||
"requires": {
|
||||
"array-buffer-byte-length": "^1.0.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"es-get-iterator": "^1.1.2",
|
||||
"get-intrinsic": "^1.1.3",
|
||||
"es-get-iterator": "^1.1.3",
|
||||
"get-intrinsic": "^1.2.1",
|
||||
"is-arguments": "^1.1.1",
|
||||
"is-array-buffer": "^3.0.1",
|
||||
"is-array-buffer": "^3.0.2",
|
||||
"is-date-object": "^1.0.5",
|
||||
"is-regex": "^1.1.4",
|
||||
"is-shared-array-buffer": "^1.0.2",
|
||||
@@ -4366,7 +4376,7 @@
|
||||
"object-is": "^1.1.5",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.4",
|
||||
"regexp.prototype.flags": "^1.4.3",
|
||||
"regexp.prototype.flags": "^1.5.0",
|
||||
"side-channel": "^1.0.4",
|
||||
"which-boxed-primitive": "^1.0.2",
|
||||
"which-collection": "^1.0.1",
|
||||
@@ -4388,12 +4398,13 @@
|
||||
}
|
||||
},
|
||||
"get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
||||
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3"
|
||||
}
|
||||
},
|
||||
@@ -4428,18 +4439,6 @@
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-typed-array": {
|
||||
"version": "1.1.10",
|
||||
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz",
|
||||
"integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==",
|
||||
"requires": {
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
"for-each": "^0.3.3",
|
||||
"gopd": "^1.0.1",
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"isarray": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
||||
@@ -4457,16 +4456,15 @@
|
||||
}
|
||||
},
|
||||
"which-typed-array": {
|
||||
"version": "1.1.9",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz",
|
||||
"integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==",
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz",
|
||||
"integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==",
|
||||
"requires": {
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
"for-each": "^0.3.3",
|
||||
"gopd": "^1.0.1",
|
||||
"has-tostringtag": "^1.0.0",
|
||||
"is-typed-array": "^1.1.10"
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4645,9 +4643,9 @@
|
||||
}
|
||||
},
|
||||
"dompurify": {
|
||||
"version": "2.4.5",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.4.5.tgz",
|
||||
"integrity": "sha512-jggCCd+8Iqp4Tsz0nIvpcb22InKEBrGz5dw3EQJMs8HPJDsKbFIO3STYtAvCfDx26Muevn1MHVI0XxjgFfmiSA==",
|
||||
"version": "2.4.7",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.4.7.tgz",
|
||||
"integrity": "sha512-kxxKlPEDa6Nc5WJi+qRgPbOAbgTpSULL+vI3NUXsZMlkJxTqYI9wg5ZTay2sFrdZRWHPWNi+EdAhcJf81WtoMQ==",
|
||||
"optional": true
|
||||
},
|
||||
"domutils": {
|
||||
@@ -4754,9 +4752,9 @@
|
||||
}
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "5.14.1",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.1.tgz",
|
||||
"integrity": "sha512-Vklwq2vDKtl0y/vtwjSesgJ5MYS7Etuk5txS8VdKL4AOS1aUlD96zqIfsOSLQsdv3xgMRbtkWM8eG9XDfKUPow==",
|
||||
"version": "5.15.0",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz",
|
||||
"integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
@@ -4830,12 +4828,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
||||
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3"
|
||||
}
|
||||
},
|
||||
@@ -4861,9 +4860,9 @@
|
||||
}
|
||||
},
|
||||
"es-module-lexer": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz",
|
||||
"integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg=="
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.0.tgz",
|
||||
"integrity": "sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA=="
|
||||
},
|
||||
"es-to-primitive": {
|
||||
"version": "1.2.1",
|
||||
@@ -14868,12 +14867,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
||||
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3"
|
||||
}
|
||||
},
|
||||
@@ -14955,6 +14955,11 @@
|
||||
"get-intrinsic": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"has-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg=="
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
|
||||
@@ -15472,12 +15477,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
||||
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3"
|
||||
}
|
||||
},
|
||||
@@ -15543,12 +15549,13 @@
|
||||
"integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw=="
|
||||
},
|
||||
"get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
||||
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3"
|
||||
}
|
||||
},
|
||||
@@ -15558,9 +15565,17 @@
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
|
||||
},
|
||||
"is-typed-array": {
|
||||
"version": "1.1.10",
|
||||
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz",
|
||||
"integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==",
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz",
|
||||
"integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==",
|
||||
"requires": {
|
||||
"which-typed-array": "^1.1.11"
|
||||
}
|
||||
},
|
||||
"which-typed-array": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz",
|
||||
"integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==",
|
||||
"requires": {
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
@@ -15939,17 +15954,17 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": {
|
||||
"version": "3.29.1",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.29.1.tgz",
|
||||
"integrity": "sha512-+jwgnhg6cQxKYIIjGtAHq2nwUOolo9eoFZ4sHfUH09BLXBgxnH4gA0zEd+t+BO2cNB8idaBtZFcFTRjQJRJmAw==",
|
||||
"version": "3.32.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.0.tgz",
|
||||
"integrity": "sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww==",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"jspdf-autotable": {
|
||||
"version": "3.5.25",
|
||||
"resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.25.tgz",
|
||||
"integrity": "sha512-BIbDd/cilRbVm5PmR+ZonolSqRtm0AvZDpTz+rrWed7BnFj5mqF7x7lkxDAMzPudLapktHUk6cxipcvUzal8cg=="
|
||||
"version": "3.5.31",
|
||||
"resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.31.tgz",
|
||||
"integrity": "sha512-Lc1KuLGDQWW/5t57Z/+c2E94XQV3jV2QVU3xMRiwvcm/nMx79aCkpPCsxLzJZVFneZvz4XoA8+egQR1QajYiWw=="
|
||||
},
|
||||
"junk": {
|
||||
"version": "3.1.0",
|
||||
@@ -18337,13 +18352,24 @@
|
||||
}
|
||||
},
|
||||
"regexp.prototype.flags": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz",
|
||||
"integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz",
|
||||
"integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3",
|
||||
"functions-have-names": "^1.2.2"
|
||||
"define-properties": "^1.2.0",
|
||||
"functions-have-names": "^1.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"define-properties": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz",
|
||||
"integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==",
|
||||
"requires": {
|
||||
"has-property-descriptors": "^1.0.0",
|
||||
"object-keys": "^1.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"regexpu-core": {
|
||||
@@ -18909,9 +18935,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"stackblur-canvas": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.5.0.tgz",
|
||||
"integrity": "sha512-EeNzTVfj+1In7aSLPKDD03F/ly4RxEuF/EX0YcOG0cKoPXs+SLZxDawQbexQDBzwROs4VKLWTOaZQlZkGBFEIQ==",
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.6.0.tgz",
|
||||
"integrity": "sha512-8S1aIA+UoF6erJYnglGPug6MaHYGo1Ot7h5fuXx4fUPvcvQfcdw2o/ppCse63+eZf8PPidSu4v1JnmEVtEDnpg==",
|
||||
"optional": true
|
||||
},
|
||||
"statuses": {
|
||||
@@ -19204,11 +19230,11 @@
|
||||
}
|
||||
},
|
||||
"tableexport.jquery.plugin": {
|
||||
"version": "1.27.0",
|
||||
"resolved": "https://registry.npmjs.org/tableexport.jquery.plugin/-/tableexport.jquery.plugin-1.27.0.tgz",
|
||||
"integrity": "sha512-aJ6XBeqtPqV8P2v8vvKNa54SGp9R4V4CIwaIhA1WTkflvoYaWqCyTmf/O6WH5kKBvDpva+RhLnYwsPHEPwdSsg==",
|
||||
"version": "1.28.0",
|
||||
"resolved": "https://registry.npmjs.org/tableexport.jquery.plugin/-/tableexport.jquery.plugin-1.28.0.tgz",
|
||||
"integrity": "sha512-ydDjOhw8A+LOu+801zPXDeMF8MoU1q2HtS2msphCuny0tdXgbXG9GJfA4ll1hBs0ABiAnOaVVZaRuxBmW/qHtw==",
|
||||
"requires": {
|
||||
"file-saver": ">=2.0.1",
|
||||
"file-saver": ">=2.0.4",
|
||||
"html2canvas": ">=1.0.0",
|
||||
"jquery": ">=3.2.1",
|
||||
"jspdf": ">=2.0.0",
|
||||
@@ -19679,9 +19705,9 @@
|
||||
}
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.86.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.86.0.tgz",
|
||||
"integrity": "sha512-3BOvworZ8SO/D4GVP+GoRC3fVeg5MO4vzmq8TJJEkdmopxyazGDxN8ClqN12uzrZW9Tv8EED8v5VSb6Sqyi0pg==",
|
||||
"version": "5.88.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.2.tgz",
|
||||
"integrity": "sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==",
|
||||
"requires": {
|
||||
"@types/eslint-scope": "^3.7.3",
|
||||
"@types/estree": "^1.0.0",
|
||||
@@ -19692,7 +19718,7 @@
|
||||
"acorn-import-assertions": "^1.9.0",
|
||||
"browserslist": "^4.14.5",
|
||||
"chrome-trace-event": "^1.0.2",
|
||||
"enhanced-resolve": "^5.14.1",
|
||||
"enhanced-resolve": "^5.15.0",
|
||||
"es-module-lexer": "^1.2.1",
|
||||
"eslint-scope": "5.1.1",
|
||||
"events": "^3.2.0",
|
||||
@@ -19702,7 +19728,7 @@
|
||||
"loader-runner": "^4.2.0",
|
||||
"mime-types": "^2.1.27",
|
||||
"neo-async": "^2.6.2",
|
||||
"schema-utils": "^3.1.2",
|
||||
"schema-utils": "^3.2.0",
|
||||
"tapable": "^2.1.1",
|
||||
"terser-webpack-plugin": "^5.3.7",
|
||||
"watchpack": "^2.4.0",
|
||||
@@ -19710,22 +19736,22 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
"integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w=="
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
|
||||
"integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA=="
|
||||
},
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw=="
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
|
||||
},
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.18",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz",
|
||||
"integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==",
|
||||
"version": "0.3.19",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz",
|
||||
"integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==",
|
||||
"requires": {
|
||||
"@jridgewell/resolve-uri": "3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "1.4.14"
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"@types/json-schema": {
|
||||
@@ -19733,11 +19759,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz",
|
||||
"integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA=="
|
||||
},
|
||||
"acorn-import-assertions": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz",
|
||||
"integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA=="
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
@@ -19749,9 +19770,9 @@
|
||||
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
|
||||
},
|
||||
"schema-utils": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.2.0.tgz",
|
||||
"integrity": "sha512-0zTyLGyDJYd/MBxG1AhJkKa6fpEBds4OQO2ut0w7OYG+ZGhGea09lijvzsqegYSik88zc7cUtIlnnO+/BvD6gQ==",
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
|
||||
"integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==",
|
||||
"requires": {
|
||||
"@types/json-schema": "^7.0.8",
|
||||
"ajv": "^6.12.5",
|
||||
@@ -19767,9 +19788,9 @@
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.17.7",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.17.7.tgz",
|
||||
"integrity": "sha512-/bi0Zm2C6VAexlGgLlVxA0P2lru/sdLyfCVaRMfKVo9nWxbmz7f/sD8VPybPeSUJaJcwmCJis9pBIhcVcG1QcQ==",
|
||||
"version": "5.19.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz",
|
||||
"integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==",
|
||||
"requires": {
|
||||
"@jridgewell/source-map": "^0.3.3",
|
||||
"acorn": "^8.8.2",
|
||||
|
||||
11
package.json
11
package.json
@@ -25,16 +25,17 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^6.4.0",
|
||||
"acorn": "^8.8.2",
|
||||
"acorn": "^8.9.0",
|
||||
"acorn-import-assertions": "^1.9.0",
|
||||
"admin-lte": "^2.4.18",
|
||||
"ajv": "^6.12.6",
|
||||
"alpinejs": "^3.10.5",
|
||||
"blueimp-file-upload": "^9.34.0",
|
||||
"bootstrap": "^3.4.1",
|
||||
"bootstrap-colorpicker": "^2.5.3",
|
||||
"bootstrap-datepicker": "^1.10.0",
|
||||
"bootstrap-less": "^3.3.8",
|
||||
"bootstrap-table": "1.21.4",
|
||||
"bootstrap-table": "1.22.1",
|
||||
"chart.js": "^2.9.4",
|
||||
"css-loader": "^4.0.0",
|
||||
"ekko-lightbox": "^5.1.1",
|
||||
@@ -44,16 +45,16 @@
|
||||
"jquery-ui": "^1.13.2",
|
||||
"jquery-ui-bundle": "^1.12.1",
|
||||
"jquery.iframe-transport": "^1.0.0",
|
||||
"jspdf-autotable": "^3.5.24",
|
||||
"jspdf-autotable": "^3.5.30",
|
||||
"less": "^4.1.2",
|
||||
"less-loader": "^5.0",
|
||||
"list.js": "^1.5.0",
|
||||
"papaparse": "^4.3.3",
|
||||
"select2": "4.0.13",
|
||||
"sheetjs": "^2.0.0",
|
||||
"tableexport.jquery.plugin": "1.27.0",
|
||||
"tableexport.jquery.plugin": "1.28.0",
|
||||
"tether": "^1.4.0",
|
||||
"vue-resource": "^1.5.2",
|
||||
"webpack": "^5.83.1"
|
||||
"webpack": "^5.88.2"
|
||||
}
|
||||
}
|
||||
|
||||
2
public/css/dist/all.css
vendored
2
public/css/dist/all.css
vendored
File diff suppressed because one or more lines are too long
2
public/css/dist/bootstrap-table.css
vendored
2
public/css/dist/bootstrap-table.css
vendored
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||
* version: 1.21.4
|
||||
* version: 1.22.1
|
||||
* https://github.com/wenzhixin/bootstrap-table/
|
||||
*/
|
||||
/* stylelint-disable annotation-no-unknown, max-line-length */
|
||||
|
||||
2968
public/js/dist/all-defer.js
vendored
Normal file
2968
public/js/dist/all-defer.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
633
public/js/dist/bootstrap-table.js
vendored
633
public/js/dist/bootstrap-table.js
vendored
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user