mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Compare commits
1729 Commits
bug/presup
...
mod/histor
| Author | SHA1 | Date | |
|---|---|---|---|
| 10889a9e7f | |||
| 8d363b8abd | |||
| 63866b6f2f | |||
| 4e65361df8 | |||
| 391927aaf6 | |||
| 96e12c0192 | |||
| 7f88ea7296 | |||
| 884f9f1a67 | |||
| c5dc026c33 | |||
| 5fbb6cc854 | |||
| 40439b532f | |||
| 84693d5c6c | |||
| 2c711c526b | |||
| a12f034daa | |||
| e732b36ece | |||
| 5fcc1bdd9d | |||
| da57cb23ee | |||
| e1aa62f198 | |||
| 50e8c35ef3 | |||
| f10d584453 | |||
| 67c4b4bc93 | |||
| 23a577b55e | |||
| 6ca84232fa | |||
| 95e153adbb | |||
| 4e8265d8a5 | |||
| e9986dd3bb | |||
| 96bc9cde73 | |||
| b9c18bf78c | |||
| 784789841d | |||
| 744680198b | |||
| f42063dd4c | |||
| 53ce60f6de | |||
| b5128bdcaf | |||
| 1350c04060 | |||
| 8ab2c28686 | |||
| b7563598e0 | |||
| 192525ebae | |||
| 78c4082596 | |||
| e0da3b56c7 | |||
| be16690f73 | |||
| aaf2ee6fd3 | |||
| 81393317b7 | |||
| 2f1b34f668 | |||
| 52c53e6920 | |||
| 3b43551064 | |||
| e5389db7be | |||
| 3db124ea24 | |||
| cd0a1c3c2a | |||
| 97568151a6 | |||
| a6fc99e726 | |||
| a86bdcac53 | |||
| 303fde9861 | |||
| 0cd68f369e | |||
| 6dc91bfa4c | |||
| 43e0ced1bd | |||
| 981eb30c02 | |||
| e070e5101e | |||
| 55ac2b4bcb | |||
| 4da8981cd8 | |||
| e625dd1e76 | |||
| e3c202ae64 | |||
| b084d1bd7c | |||
| 611df53de1 | |||
| aba97202cc | |||
| b775f65b3a | |||
| 690eaf4195 | |||
| 1e47b58400 | |||
| dd530b8b89 | |||
| e33e5e0840 | |||
| 2faa88297e | |||
| 306ae02a10 | |||
| 242029714d | |||
| edbca8fc6e | |||
| cb17d661a8 | |||
| 5f76e0e437 | |||
| 976c7980d4 | |||
| 42edf2bbc0 | |||
| 64337257ee | |||
| 2ef98a9496 | |||
| b500229b37 | |||
| 438000ebad | |||
| decdcf3703 | |||
| f5a015bc6d | |||
| 359e13260f | |||
| cfdc8d64e1 | |||
| 22bdb9b960 | |||
| 1991691533 | |||
| 760b9bdd94 | |||
| ce124cb38a | |||
| 778ef712e9 | |||
| bc7929f44b | |||
| 438e696e88 | |||
| 199e5f2018 | |||
| cb15fbe94a | |||
| fa77952ea6 | |||
| 88d6b69857 | |||
| 7ffaec042c | |||
| 6ba2694733 | |||
| 15ce7ed670 | |||
| 565ef7f170 | |||
| f3c92fa205 | |||
| 6ee4b1e89d | |||
| d253183ab6 | |||
| 3e6ba658cd | |||
| de536b894d | |||
| 836ace0e42 | |||
| bbea2229d7 | |||
| 90a47aa6bb | |||
| 59609df471 | |||
| 43ae427137 | |||
| 36a2740eb7 | |||
| 0a9d1ef68d | |||
| a9d9dbab5c | |||
| 79dc8ca713 | |||
| f7d08b9c79 | |||
| f4ef874568 | |||
| 6537e16a0a | |||
| 5d228cc10c | |||
| ed9f67badd | |||
| ff7ed8f594 | |||
| ec4d00e0ab | |||
| 85318aa10e | |||
| a4782358c6 | |||
| 528f117c7c | |||
| 6775646ec3 | |||
| efef0c0199 | |||
| 5057586987 | |||
| 15227998aa | |||
| 456dc7ff18 | |||
| 89bcd0bda1 | |||
| 1a1f5947a0 | |||
| 999553f767 | |||
| 89e6d0787a | |||
| cbe8ee0f5c | |||
| 51d0a1bcfe | |||
| eeba76b124 | |||
| 33a3ccb832 | |||
| d3dd18a156 | |||
| cab7bc3daf | |||
| 804d8ba28b | |||
| 7101c8934e | |||
| 20594bd44c | |||
| c2011e1c25 | |||
| 8b340b76d3 | |||
| 5ae2827623 | |||
| f6b8d2ba85 | |||
| ddd7c471a1 | |||
| 30c5b06d3d | |||
| aac8ab24be | |||
| 99ffe1f462 | |||
| caac71a48d | |||
| 478077721b | |||
| 10b5ae911a | |||
| 43fef3a1a0 | |||
| c6fb4b3213 | |||
| 247fa7e6f9 | |||
| 21e907ad50 | |||
| bf146d4024 | |||
| 68a39bd749 | |||
| 514905ff47 | |||
| 75f06c44a1 | |||
| 4120ded07b | |||
| 24fc4ff1c1 | |||
| 899365f2c2 | |||
| 302d12da1e | |||
| 659d1d17ea | |||
| ff5d853032 | |||
| ba6f92b3e6 | |||
| 1ebc22c74b | |||
| 785b9ea693 | |||
| d2c6d131b3 | |||
| df1f003cbd | |||
| 3936e3175a | |||
| 571338c4b3 | |||
| 5e5cff9eae | |||
| 1d75f825a4 | |||
| 95e10820a3 | |||
| b41dc836c7 | |||
| 4afcf05049 | |||
| 0ecd18f5ff | |||
| ff648fec87 | |||
| b5c1053f8c | |||
| 4701329d25 | |||
| 7a119eb197 | |||
| 3f8b7981c7 | |||
| fa6e9208a1 | |||
| 1f1bd32fa4 | |||
| 8100350e3b | |||
| 2af2dcdbb8 | |||
| 1c581db4cf | |||
| b4dfdfa101 | |||
| 8cbe5a7051 | |||
| 46176adc70 | |||
| 67bac8f666 | |||
| ba3f4ab43c | |||
| 058857e51b | |||
| 5ce6859a2f | |||
| 2bfdd89085 | |||
| 305eea00e6 | |||
| 8ea6128109 | |||
| 7b645539e3 | |||
| fb7f2a28d9 | |||
| 39639d9ff8 | |||
| 3f90665c39 | |||
| 71e70bf551 | |||
| db70c57fb3 | |||
| 91b044bbae | |||
| a88ffda50d | |||
| 746955c3b1 | |||
| 8ca0a40b2b | |||
| 20c009f445 | |||
| 5138681718 | |||
| 9283059f9d | |||
| b75278f449 | |||
| 3fb944ff97 | |||
| c7250cb8fd | |||
| 7a9b2af8a6 | |||
| cf5a42de8d | |||
| a259d76e5e | |||
| f696153d74 | |||
| 9181905233 | |||
| 0ec7dff479 | |||
| b0fb0f18fb | |||
| cf4c4df80a | |||
| 36c9227586 | |||
| 4e9dfb51c7 | |||
| 5aab9a33ac | |||
| ea762a09c0 | |||
| 21014d029f | |||
| 9c31f2bbc5 | |||
| b288ca498c | |||
| 96a6845c0c | |||
| eed5c0994e | |||
| e2ab42cd84 | |||
| 7da76af866 | |||
| bf1e66d746 | |||
| adccc414be | |||
| 95fa192cb9 | |||
| 9310d2dabd | |||
| 3abf45ca6e | |||
| 6ea22066c2 | |||
| bf21a336b1 | |||
| d1e5731d1d | |||
| 029757bb40 | |||
| bb4c9690b9 | |||
| 6d45a950df | |||
| 6f8890a8b1 | |||
| c093c01c00 | |||
| a4532a7ff6 | |||
| 31a12ff343 | |||
| 1d6f5fe53e | |||
| 0b767c63e9 | |||
| e464652fe2 | |||
| dd20f2a20e | |||
| 97554bffc9 | |||
| 73e9e941ed | |||
| 05720cf1ce | |||
| 04e9e3ee6f | |||
| 9804a6a927 | |||
| 3402e67fb2 | |||
| b1932e6f85 | |||
| 13ae70236e | |||
| 4d8332e625 | |||
| c75d08b3c3 | |||
| a0b5f3b4df | |||
| 0e444295e3 | |||
| ae7707057a | |||
| ff115f4f20 | |||
| 45e41c77e4 | |||
| ae456c8890 | |||
| e8958dc893 | |||
| b0ac132e59 | |||
| b50e564641 | |||
| 894770d6ce | |||
| 367c7c2ea8 | |||
| 9375b9b624 | |||
| 9a6a4f89a2 | |||
| 7f31e65960 | |||
| 5aa2a2e6c9 | |||
| dfbcb13ba5 | |||
| 033184cfa2 | |||
| 25b6d14423 | |||
| 96bd24ae8b | |||
| b5b86b4164 | |||
| ef173ab0fc | |||
| f473caf06c | |||
| 5e8a7f8bd4 | |||
| 905112334f | |||
| d0f37cb714 | |||
| 151e4a2d7a | |||
| 05ebfa06df | |||
| dafdf68c41 | |||
| 4379a9d23b | |||
| cc2c9eee1c | |||
| b942064608 | |||
| 52b3b1ae4d | |||
| 86dafb1133 | |||
| 5c68334e9a | |||
| f16654f4ad | |||
| a1fd7075d6 | |||
| 4fd242d4d2 | |||
| 3838bcb536 | |||
| e2011529b4 | |||
| 616c12002e | |||
| ab36e86bdb | |||
| 1ce4ac36a6 | |||
| 7bfb49f412 | |||
| f7b9c23f69 | |||
| f7d1c59c6a | |||
| e918b5f400 | |||
| 8b949a3173 | |||
| e0916b567c | |||
| 3779b3b8a0 | |||
| 6175da1d61 | |||
| 9473c10f97 | |||
| 800d32afde | |||
| 00401aaf7f | |||
| 919c80fa9b | |||
| b5b4d6b026 | |||
| 5ac1e3d4c1 | |||
| 7dee2c26e8 | |||
| 649a244a10 | |||
| 288a3f02eb | |||
| 952500e10e | |||
| 2cfe03b2ec | |||
| b28c0d9f71 | |||
| 01c7da8ca6 | |||
| 13128ebdae | |||
| 6016b6145c | |||
| 6450231b53 | |||
| b86acc3949 | |||
| 92a6a3c16c | |||
| 62a95a0ca8 | |||
| ed5f73db25 | |||
| ddf02f73b8 | |||
| b555e988be | |||
| 2050f0ae1e | |||
| fc1b69f2fe | |||
| 946527cc1a | |||
| 33d3e74e80 | |||
| 67a7cda036 | |||
| ed28263994 | |||
| 0d24e50d01 | |||
| a27536e406 | |||
| 4af34d7ba4 | |||
| 753aafe05d | |||
| 63254f0bf3 | |||
| 0afd31aae0 | |||
| dd723f9889 | |||
| 703781e115 | |||
| 9ae3d8707c | |||
| c344274f9d | |||
| e18a39938b | |||
| 5ebf2c670f | |||
| 12e06937c4 | |||
| fe164c4ab3 | |||
| 9cb7762905 | |||
| 548a444b7d | |||
| 969966ac78 | |||
| b318721b90 | |||
| a137ede1a7 | |||
| 5eaa5fea0b | |||
| 19fd76e910 | |||
| 14b5f4bf95 | |||
| 61abcb3dbd | |||
| f2ea93ddb6 | |||
| 31524dcf61 | |||
| c3d38e29a4 | |||
| f93ecda648 | |||
| 49f9fe4009 | |||
| 65c9b34f56 | |||
| 46c29f3c13 | |||
| 0b04e6dabd | |||
| 15f6d0d675 | |||
| 3949607a3c | |||
| 9e90ec798c | |||
| 76baae9e92 | |||
| 52a4e7d37b | |||
| 972d0c4ec8 | |||
| 36f5d42d03 | |||
| c28753e1f1 | |||
| 8e97e7b58c | |||
| f19d2b7ffe | |||
| 2a8c4b9da6 | |||
| d50b511e83 | |||
| 3ada529b6e | |||
| 02a64fa40a | |||
| c42f223b9a | |||
| 173afe403e | |||
| c76f4428a6 | |||
| 6a4e753a06 | |||
| 7ee844fb0c | |||
| 6d5b8ab621 | |||
| a74021f97d | |||
| 725ea61078 | |||
| 5dbb40af1d | |||
| c6db000057 | |||
| 6a4e9b611e | |||
| fedc608463 | |||
| 4667e77144 | |||
| 7cf1bf006d | |||
| 10e18d60e4 | |||
| 67e588dd67 | |||
| 0fe2470477 | |||
| ea59390b75 | |||
| a52745fe09 | |||
| 2102a44a1e | |||
| ab99baaa81 | |||
| 9f46569b01 | |||
| 14c5cf493c | |||
| 16dc39ee15 | |||
| ebf0a9d5d7 | |||
| c157b1215c | |||
| c226f031d9 | |||
| f9909bd8cd | |||
| c75a2f9ef4 | |||
| 137d5b9db2 | |||
| 0d21a7ab3b | |||
| e9827c3557 | |||
| f0a4f19089 | |||
| 084f3220e1 | |||
| b28b8b761e | |||
| 42a0aed019 | |||
| f343071311 | |||
| e2da90926d | |||
| 08a91294b4 | |||
| f5d01e520a | |||
| ba9c4dc339 | |||
| 41159d1588 | |||
| 5e8da603f9 | |||
| f031e31930 | |||
| e8123c9fb8 | |||
| abc8db6b8b | |||
| a31e0bddb6 | |||
| 9981f878d1 | |||
| 7350e193e5 | |||
| 9ee2a833b5 | |||
| 8cd4570845 | |||
| 89531f1a1b | |||
| 8912606c9a | |||
| f966f2d47a | |||
| 2e845b7355 | |||
| 803b979e0d | |||
| 79fcb1e3fe | |||
| 9b6b66af13 | |||
| 3d535e4ed5 | |||
| bb9f6210e7 | |||
| da8917b0d3 | |||
| 38d60402c0 | |||
| e7394999ab | |||
| ba54d99185 | |||
| efb50383b7 | |||
| de8ae93871 | |||
| defb7373c4 | |||
| a4f6f8cdb3 | |||
| 1e339b5503 | |||
| 9e591a099d | |||
| 269410c2c7 | |||
| 49f3430f12 | |||
| 64e4f51e13 | |||
| 10781c40a9 | |||
| 026a109b5e | |||
| cce8b1845f | |||
| 7139bb377c | |||
| 29e130458a | |||
| d8cb02271e | |||
| b37f3f663a | |||
| 014b48e693 | |||
| af57f7d5ae | |||
| b7c5c328da | |||
| 5a2b2ee7cb | |||
| 94a2a1dd2e | |||
| 84155d1f71 | |||
| fc52417b53 | |||
| 03135fdac7 | |||
| 3cfdc584e5 | |||
| c0de7ec238 | |||
| ae9af197ac | |||
| ab4afe7492 | |||
| 982b008ada | |||
| 036c11b4ab | |||
| 644ad41001 | |||
| b413245683 | |||
| 0116553b2b | |||
| 4b57c716ab | |||
| df05f4b5b4 | |||
| 6c20121f0c | |||
| 885aea495c | |||
| a6f07a15b5 | |||
| 432567e964 | |||
| 470732ca39 | |||
| 5b15d7a72e | |||
| 64a6e0c5f4 | |||
| c8598cbd27 | |||
| e96c738839 | |||
| a62e51d31c | |||
| 4f5bc3301f | |||
| 4633fa623a | |||
| ce1d94bbda | |||
| 387667b0c2 | |||
| 66825d3286 | |||
| 3baa7c9e51 | |||
| c450d4f804 | |||
| 937af8f5d9 | |||
| 6045d65935 | |||
| 78584f22c3 | |||
| 2de72e4278 | |||
| e5b2bc19d4 | |||
| ce325d73dc | |||
| 301152c6e2 | |||
| 1b451ab08e | |||
| c42a7bae44 | |||
| c6bc2e532f | |||
| 2b343b0dd9 | |||
| 89ec78bc31 | |||
| 2857697fd2 | |||
| 2eb51ffd55 | |||
| b320856af8 | |||
| 071dceced8 | |||
| 75eea1a736 | |||
| c14eb1f3c3 | |||
| 7aa1a33767 | |||
| f56ede87da | |||
| ea11011aca | |||
| 7a316d9b81 | |||
| 5051bddf36 | |||
| 98d47a0f0f | |||
| cfa3f7329f | |||
| f362087c01 | |||
| 4343b86640 | |||
| ccfc78ed0d | |||
| 4fb6533926 | |||
| 2c59ac33df | |||
| 73e6106e4f | |||
| b17abbdfa8 | |||
| 60b77453d9 | |||
| e29e77703d | |||
| 139724ae8a | |||
| 7dd2e8c1c6 | |||
| 87b52afab3 | |||
| 0533d051c4 | |||
| fa03a872dc | |||
| c31aa262e2 | |||
| 87dcd73c40 | |||
| 21dceb2c23 | |||
| 1a3b067fbc | |||
| c493f7c8ac | |||
| 4545c33a27 | |||
| e70e3b9683 | |||
| f937695714 | |||
| 6b1dc57821 | |||
| 077cfd7d82 | |||
| 244361a1ce | |||
| cddf64b025 | |||
| c9d6196aac | |||
| a0cb703991 | |||
| 2d794aa1a3 | |||
| 6594cb6f51 | |||
| c832af90d0 | |||
| 3d6e8b4886 | |||
| 00ff185cf1 | |||
| 1777f435d9 | |||
| b141dcacb8 | |||
| eae40ff4d8 | |||
| cdf70c19ff | |||
| 1d4f8696e1 | |||
| 6208839a12 | |||
| 8830f59665 | |||
| 5b048b8a1b | |||
| 92f7d30c99 | |||
| c9e655ca82 | |||
| 750847e3b6 | |||
| d017115530 | |||
| 27126dbaed | |||
| 41bdae0623 | |||
| e593f3000b | |||
| 0cde6d5fc5 | |||
| 465ab4c8f5 | |||
| dc4647fee7 | |||
| 5d4cc98a91 | |||
| cbf4ddd550 | |||
| 40b37962a8 | |||
| 4f07f45676 | |||
| 398afbaeda | |||
| a123c2dfa7 | |||
| ac804e9720 | |||
| ab63043f36 | |||
| b79f490f17 | |||
| bb848d391f | |||
| cecf193e37 | |||
| 9cbbddcc1c | |||
| 5f3bc61a41 | |||
| 0a10c91159 | |||
| 2ff4a8fb9d | |||
| d294ea2811 | |||
| 69f6d6cbeb | |||
| 9e9eb1f56f | |||
| 91c820feed | |||
| b279bd5321 | |||
| 9b83f6e722 | |||
| b5cc032afc | |||
| 88e98962d1 | |||
| 9d071e462c | |||
| d51949c593 | |||
| 4d21ff78ff | |||
| 3dc7b816a5 | |||
| 6e5d2c3e94 | |||
| a481375028 | |||
| 371e986baf | |||
| 4872e498a5 | |||
| c960fd8539 | |||
| 9924f27b5b | |||
| 492c7366cf | |||
| dc4db78b76 | |||
| 41291c82fd | |||
| 69aa3f4837 | |||
| b4a835bbfd | |||
| ef79cc5c2e | |||
| 0f5e8a223b | |||
| ecbd762c7f | |||
| d42f46d280 | |||
| c2b61a3d99 | |||
| babd832606 | |||
| 210c87ab11 | |||
| efcda66c0b | |||
| ff4587333a | |||
| 121a29d493 | |||
| bb78f9cbd8 | |||
| 29245d45c4 | |||
| 8a9df3a41a | |||
| d44686607a | |||
| 432cc6be01 | |||
| 04a2a44760 | |||
| 3cb512d93a | |||
| fb2d12e318 | |||
| c5feb39e8b | |||
| d5534269b3 | |||
| dde339ad44 | |||
| cdc4bf6fcd | |||
| 460cb0344f | |||
| c7fdd1a9a3 | |||
| c65c6571cd | |||
| ba0ad10935 | |||
| e1fa993fcd | |||
| 4991642d48 | |||
| 053ce49279 | |||
| bc969828b9 | |||
| f553641818 | |||
| 5a5ce4835b | |||
| 4810ab99c1 | |||
| 18f391a733 | |||
| 1bd27776f4 | |||
| 30a6de5e75 | |||
| d1a9aaac77 | |||
| e520b5b621 | |||
| 50cd951755 | |||
| 8c64b678fe | |||
| 8d289fde15 | |||
| c4b1620c1b | |||
| adfa8bc465 | |||
| 33ce64df0f | |||
| 0e91105f68 | |||
| 06bd6d4870 | |||
| e3c494e68d | |||
| 47455cd9c2 | |||
| 5623df8797 | |||
| 08cbee4ae8 | |||
| 6929db5abc | |||
| f43dd069d6 | |||
| 5a5e0be855 | |||
| 3430b2d9d1 | |||
| 793f378f98 | |||
| 670c10fdde | |||
| f37805d310 | |||
| e6ce820480 | |||
| 1b38861465 | |||
| e44421fb4d | |||
| 81573eede4 | |||
| 09e8af15cc | |||
| 4a6b974e94 | |||
| ee7c161ef2 | |||
| ff73caec21 | |||
| f89f3bf00f | |||
| 77093e7311 | |||
| f2aa8f6287 | |||
| 13693655f1 | |||
| 927b58245d | |||
| d15bbb42f1 | |||
| 99bd10b979 | |||
| 9c3ee4b24a | |||
| 43dd04a0a2 | |||
| 8caa6e8bab | |||
| 9ebdc4441f | |||
| 37fba3604a | |||
| c3ab272de3 | |||
| c54242eb24 | |||
| 180b845b1a | |||
| 7b3096efb3 | |||
| 20db840bf9 | |||
| 74867ca1ac | |||
| 3c4b7e71e4 | |||
| 9d6ead4472 | |||
| c0d54e28b7 | |||
| 754bea37a8 | |||
| 67546d347f | |||
| a18207202c | |||
| fc62ef582a | |||
| 6979670eae | |||
| 8dc6d7fee2 | |||
| e1d208a4dd | |||
| af25237fa5 | |||
| a1cef4eac3 | |||
| 7986627a62 | |||
| 61af547135 | |||
| 6e96beeec8 | |||
| 0fd4fd4410 | |||
| f6c2e608cf | |||
| 756578a251 | |||
| 63ec2c8bf0 | |||
| 8f6c86bad5 | |||
| 7106d46106 | |||
| b9a742a7a7 | |||
| 042ab22b08 | |||
| e3cb1f81b9 | |||
| bbd8104ce7 | |||
| 60554fd479 | |||
| e9c889624d | |||
| daafdf2d5a | |||
| 5e542dc862 | |||
| ac2d93eb7a | |||
| 2dfa0a947a | |||
| 9370442103 | |||
| d417db18e2 | |||
| 4ef91da9b3 | |||
| 3662613ba5 | |||
| 55157d23aa | |||
| b627146dc4 | |||
| e71dd46a48 | |||
| f6da97d9eb | |||
| ed7e697d2d | |||
| bc03dd6a46 | |||
| cd3df81bc9 | |||
| 02596457d8 | |||
| 36c5728b30 | |||
| c1ba45f124 | |||
| 6ff93a034c | |||
| 9ada8d0ba0 | |||
| 76208d9720 | |||
| a4658ce104 | |||
| 44d484da29 | |||
| ce95556a88 | |||
| 904e429c95 | |||
| ecba8a73af | |||
| 8ef08d93e9 | |||
| f0e9f3562c | |||
| f78d392d59 | |||
| 10778831e5 | |||
| 7660c1400b | |||
| a233467539 | |||
| c699da12c8 | |||
| 172165c27a | |||
| b6a17e0d34 | |||
| d65105ed13 | |||
| 2edde4943d | |||
| 2587a6b4ac | |||
| e5e53c026a | |||
| 4c75cb6f94 | |||
| e8af8aad43 | |||
| 24412c63ca | |||
| 18700b6c96 | |||
| df2707063b | |||
| 3140e527e8 | |||
| b99fb1a3e4 | |||
| e9612b0bc2 | |||
| de01161964 | |||
| 1857fb0537 | |||
| 3809493c79 | |||
| 157bff170c | |||
| dfa9f76621 | |||
| b126c910d6 | |||
| 34c79118b7 | |||
| f945d19972 | |||
| a58d8a2b81 | |||
| a9333448ee | |||
| c86f1799b5 | |||
| 977ab6400f | |||
| 8e3df0f113 | |||
| ac606b28e0 | |||
| 71590ba2ce | |||
| 94c8076f3a | |||
| 4adc124ca2 | |||
| 794e549abc | |||
| 34378e0d93 | |||
| 3204d550b7 | |||
| 4bf8018c65 | |||
| 26980297ed | |||
| 0b786d42a7 | |||
| ae561d1e19 | |||
| 30e1561a0b | |||
| 3406fb3005 | |||
| ff59207d4c | |||
| fcd6adebb7 | |||
| fbfa70a734 | |||
| 4601b15abe | |||
| c1cae0fcf7 | |||
| c5f1f0e55a | |||
| dc92e352b9 | |||
| 046c31eb62 | |||
| eea947e80b | |||
| d347c9187b | |||
| 0f7fa4a809 | |||
| f270b6dee8 | |||
| 190037f9df | |||
| 73980295da | |||
| 339c979ded | |||
| 03870cf133 | |||
| e7088b635a | |||
| def7539710 | |||
| 6264dbe17e | |||
| 755b12e830 | |||
| 83dedefa23 | |||
| feea7d7437 | |||
| c666925101 | |||
| 068a2307bc | |||
| 9329aececc | |||
| 9311c7b9ae | |||
| 851b224149 | |||
| 627d59444b | |||
| 8c771d9779 | |||
| e32a5e4820 | |||
| ad0f5d4234 | |||
| ebaf4364ac | |||
| bff5830c9b | |||
| 91796e993c | |||
| 091088085c | |||
| e81dc3f88f | |||
| 9d423c7fa9 | |||
| cf74749889 | |||
| fdd5076920 | |||
| b0c2beb334 | |||
| a3cf44d405 | |||
| e76540ab52 | |||
| 4fee73229b | |||
| 1af261eff9 | |||
| 84e7bf3dbb | |||
| b6decf8657 | |||
| fea409b5ad | |||
| 1da50e9f01 | |||
| 4576747ac1 | |||
| 35c988a0be | |||
| b22012d170 | |||
| da7d768f36 | |||
| c905e7c005 | |||
| bd8ed62423 | |||
| 878efb4378 | |||
| a8339390b8 | |||
| af9986f354 | |||
| 2402ea2835 | |||
| dd54c69aba | |||
| 4beef3b0ae | |||
| 4409ed8652 | |||
| 1ea00b5522 | |||
| 4b1092df5f | |||
| 3cdc38b822 | |||
| 61fdceb8e1 | |||
| ea8765e708 | |||
| 71b8b2db13 | |||
| 8b03dc6de6 | |||
| b6b8df0061 | |||
| 3c1ef699bf | |||
| 809a705c88 | |||
| aff79ec3d6 | |||
| 82665c778d | |||
| 47fa27402f | |||
| 4364bc3c07 | |||
| 4a8aaf906c | |||
| a616ec7ba7 | |||
| b3cc82636d | |||
| eea415fb47 | |||
| 5045431b97 | |||
| 8657218c7a | |||
| 5b7493f3cf | |||
| 3f7e95322c | |||
| b8b5d5f69b | |||
| 7066a63254 | |||
| 10d5c286a6 | |||
| 343899013f | |||
| c1509baef9 | |||
| 77adb8ac37 | |||
| bf987a7ce3 | |||
| 84a1b3cf98 | |||
| 97a05d5568 | |||
| 32a80370d9 | |||
| 49a1904eae | |||
| 3b80471773 | |||
| 0457ac97eb | |||
| 977cdeb12b | |||
| 73d8c919bc | |||
| 071d386d36 | |||
| 41783f5b25 | |||
| 0d2a57592c | |||
| a07e68a603 | |||
| 7b7e386ffd | |||
| e8145888c9 | |||
| 5475fd8ad9 | |||
| 206a5e0cca | |||
| b496553e09 | |||
| 383c51ee1e | |||
| ff92691a07 | |||
| 8cbcd3ccb7 | |||
| 363976833c | |||
| 348dda9cd1 | |||
| 9b7c6c4ec1 | |||
| 3efec5e6cb | |||
| 816a321e1a | |||
| 8105388563 | |||
| c3791ac343 | |||
| eb722ebbca | |||
| aebc38a126 | |||
| ad8bdb7d5e | |||
| 5db68ed991 | |||
| 32398d8742 | |||
| f532c79b27 | |||
| cf6d4318c3 | |||
| 5ad2fcd566 | |||
| 21a4e5b8bd | |||
| a138330e24 | |||
| 09683d9be5 | |||
| 6cc9045eb4 | |||
| 82537d9806 | |||
| 04e5090095 | |||
| bddd99cec0 | |||
| b096d0469d | |||
| bbe802d2b7 | |||
| 2a32bc0b80 | |||
| 38db358eae | |||
| 021cd51666 | |||
| 77bb8cad91 | |||
| 1b4d287892 | |||
| 3c47b7b596 | |||
| ad83489840 | |||
| c596b9ea3a | |||
| 2855e2a985 | |||
| b21edbe915 | |||
| 186adbee00 | |||
| 319a7e0992 | |||
| 8a965c9d8e | |||
| 3b61f0a8c6 | |||
| 5ea0b6a467 | |||
| 23a6e4e8e5 | |||
| f4ccc283cc | |||
| 2149796cbb | |||
| 430cf0fd6c | |||
| 61c2e885eb | |||
| 09f44ca3aa | |||
| bea385378d | |||
| 0264fdc5b9 | |||
| db2aee6342 | |||
| a7b9feba5d | |||
| db0a537bd8 | |||
| b97f7fda24 | |||
| f5e6828212 | |||
| cab416ce7e | |||
| b4fa79cc5c | |||
| 27c1e511b3 | |||
| 264838e62a | |||
| b67b41148b | |||
| 430e20201e | |||
| 963b46c48d | |||
| d61ea0d380 | |||
| 9ed6e7b230 | |||
| af3eea3e12 | |||
| 5984f53bad | |||
| 2a1bcbd53d | |||
| 3bfaa65d19 | |||
| e17e72f46d | |||
| a05398e0aa | |||
| 28d8434b05 | |||
| c7491db102 | |||
| 432a41b879 | |||
| e413f5b26e | |||
| b29b061f74 | |||
| a75ef4eae6 | |||
| 31f7f92448 | |||
| 5ca35554e5 | |||
| b87a75d1fa | |||
| 2871326989 | |||
| 7e3d1d5df4 | |||
| 1ef49490bd | |||
| 2e1e6d4408 | |||
| 5b89cc0c1d | |||
| 20442bb784 | |||
| 2af5a0155c | |||
| 961ea42ac4 | |||
| bf49d601cf | |||
| 22f78363cb | |||
| 6f016dda6d | |||
| e87e278dd0 | |||
| 2df3f5914e | |||
| 8417c2401f | |||
| 2e1a6222ef | |||
| d219237440 | |||
| 900400f494 | |||
| 19220ab985 | |||
| 910df7b822 | |||
| 9619dfbfb5 | |||
| 0d3ea391d7 | |||
| 25040ad6b5 | |||
| 98d8d45899 | |||
| a32b8befcb | |||
| 330d1c7a4f | |||
| 1c3f045488 | |||
| cb661b55ac | |||
| 36107bd825 | |||
| 66d90ac15b | |||
| c6b7505f1b | |||
| b315a44c9a | |||
| e05e807b65 | |||
| dd2f19b86c | |||
| 0f9395115f | |||
| f9b84fa443 | |||
| 4d343ec59c | |||
| bd9764ffab | |||
| c40945f91a | |||
| ecd280928e | |||
| e37dbe85a2 | |||
| bc02e3f2bb | |||
| 1a05fe762a | |||
| 3bcd9466c6 | |||
| eb692a121e | |||
| 92298cf5f1 | |||
| 36a0f018ae | |||
| 93c350ed5c | |||
| 18c267ce04 | |||
| d427ed308d | |||
| fe289bc3ce | |||
| 01498361e3 | |||
| bb6e5fb5ca | |||
| 62d1ca88c1 | |||
| d7011acba4 | |||
| aa5dea2cfb | |||
| 036998e71a | |||
| 5ffb52d6e8 | |||
| e7163efc5e | |||
| 398cb23f11 | |||
| f4ef65ab78 | |||
| 591a872234 | |||
| e5b5e86dc8 | |||
| fee6e3b674 | |||
| d458498fad | |||
| 9b0604bed6 | |||
| acab62674e | |||
| 84accc8e03 | |||
| c478659124 | |||
| 88e503067a | |||
| ceaaf7b2dc | |||
| ad62c7bdc4 | |||
| c5440ad76e | |||
| 2284d5fbd8 | |||
| 8bea6264c5 | |||
| 306addd9ad | |||
| 6bea1c8b13 | |||
| e1a163ef8c | |||
| 874200fe67 | |||
| ed5635e783 | |||
| 8df52ea657 | |||
| 74baeb5cfa | |||
| 15d9a42740 | |||
| 9063588bcd | |||
| 586d76896f | |||
| f6684563cf | |||
| 2fc1c637ed | |||
| 1722dbecdb | |||
| 0336b2eb60 | |||
| a9eece668c | |||
| a4394ed470 | |||
| 28a133f687 | |||
| 522e026ded | |||
| c6d1d06d8a | |||
| f93251b7bf | |||
| 0b2f2a446e | |||
| 2aae650196 | |||
| 8d5649a51d | |||
| c7a24c77b4 | |||
| 4842356f8d | |||
| 7bb7b807a5 | |||
| 7e7c686f79 | |||
| 1dd02a9b66 | |||
| 5d4e59acd5 | |||
| 130457f0ef | |||
| 571d4df828 | |||
| 795cda0fd1 | |||
| a565bb8fe5 | |||
| 72ca022e16 | |||
| b0cb2bffca | |||
| 5edc85c9f7 | |||
| 642b445cd2 | |||
| a88f3fb009 | |||
| 73afe4e4c1 | |||
| 212b1f4d08 | |||
| 5a6174a597 | |||
| f0757a4be6 | |||
| 50b057d4e5 | |||
| 05de0091bd | |||
| b076db3a7c | |||
| dac82253a2 | |||
| ee22aaab16 | |||
| 6433faec02 | |||
| 4777e22952 | |||
| 3c3bea27c9 | |||
| 9b6cc84d4f | |||
| 012723d955 | |||
| adacb6ddc8 | |||
| 49cb2d1a38 | |||
| 163d8421a5 | |||
| 82414d8393 | |||
| 879d34306b | |||
| ff082dac7f | |||
| 883308d052 | |||
| 4f7cbb99fd | |||
| e9d4b0971b | |||
| 0a45a7b01e | |||
| dc599e009a | |||
| b50ba4f2a3 | |||
| 2231e943c7 | |||
| 1ccade47a3 | |||
| ef58fe7209 | |||
| 09a7ab5e50 | |||
| 8ad09ed495 | |||
| 0781a283eb | |||
| a29df443bd | |||
| 93d3793ef9 | |||
| d53b63d032 | |||
| afb7ca0812 | |||
| d0bdef58c2 | |||
| f61c9928dc | |||
| 616e662896 | |||
| 340ab4ec5f | |||
| 2d9b1603a3 | |||
| 33a20b9b25 | |||
| 6308b4d883 | |||
| b80480a101 | |||
| a3ac7150e5 | |||
| 9e1983ee66 | |||
| b3fcdba990 | |||
| 157e212065 | |||
| b1fe5f2b56 | |||
| 3212d00cfe | |||
| 9dd3f8598e | |||
| 54579b36bf | |||
| 2890eacb74 | |||
| f0dcdc55d9 | |||
| fc94fcc55e | |||
| c05b117c77 | |||
| 66a36bcf3b | |||
| 7608793c8a | |||
| 495fc6e73f | |||
| bd92842877 | |||
| 60706ecfc2 | |||
| 6790c21675 | |||
| c3098b054e | |||
| 77db3104d3 | |||
| 57c34b768d | |||
| 446f071dd2 | |||
| 1f74b38b8d | |||
| 8dca0936c5 | |||
| 41b4ec5cd3 | |||
| bb138019d5 | |||
| 2df473edb6 | |||
| 643f84684a | |||
| 4e7f53ba6c | |||
| 43f2daea59 | |||
| 7aa75cdd59 | |||
| 586dfa7343 | |||
| 422ade0030 | |||
| d7d1791d64 | |||
| 4cacf28d49 | |||
| d5719b70a1 | |||
| 7998e2424e | |||
| fce30342a7 | |||
| 8d25991ddc | |||
| 9a0581319c | |||
| 7c5fdc0c88 | |||
| 721eb445dc | |||
| 45f31049ab | |||
| ba793730f3 | |||
| c0297b6cba | |||
| afd0b038c9 | |||
| e92179697b | |||
| 2b9de61864 | |||
| 6cb70f1a79 | |||
| bef0c95a4f | |||
| 271ec8c807 | |||
| b4de7978cc | |||
| 4b4c320e04 | |||
| 9ae9b4e7a7 | |||
| 5a1fcb4eaa | |||
| 1dd442d25a | |||
| c175cc392c | |||
| aebfeb77d9 | |||
| 74de9330cc | |||
| b333ad736c | |||
| 71157bfda5 | |||
| f70f6a0929 | |||
| 9a57312601 | |||
| ad11dc2443 | |||
| 719455567e | |||
| 0b4105f5bd | |||
| 5ce47dc6ce | |||
| d9d3bd69c0 | |||
| ece908c954 | |||
| 94ca8a5a7a | |||
| 39ca7e83eb | |||
| ed67af00b4 | |||
| 1b09d6c7a9 | |||
| 9fa31c5d8e | |||
| 73821603b4 | |||
| 3aaee893eb | |||
| ea4d4327b7 | |||
| 16cec58431 | |||
| 8f907b2762 | |||
| e24839019a | |||
| d02e7e03f4 | |||
| a7cda851f0 | |||
| 3fb37af0f8 | |||
| 65f179bdd8 | |||
| aa22b81c96 | |||
| abf60e62c4 | |||
| 0f305c16b3 | |||
| 2c3b8cb581 | |||
| 6bd9580c43 | |||
| 515d275c7e | |||
| 2b876f623e | |||
| af131b6658 | |||
| 54de854bbc | |||
| 3c8d99c873 | |||
| 67734cc427 | |||
| 310b4e7a43 | |||
| 53ed8299df | |||
| 6eb4446aff | |||
| 9bec8f7adb | |||
| 510e33b5fa | |||
| ce050cf07d | |||
| a1ddc8a520 | |||
| d870fca64d | |||
| 7550f41e16 | |||
| 2bef4e1139 | |||
| 2e767889ef | |||
| c9c462ab92 | |||
| 117c5f2f97 | |||
| 5c705ebf64 | |||
| ce33239835 | |||
| 5169a86cf4 | |||
| e1f02d4506 | |||
| 5e60351755 | |||
| 81d52f0064 | |||
| 4cf4e3fcfd | |||
| fe4c7c1218 | |||
| b314e4a1de | |||
| c1aecb43f2 | |||
| 524eb68b1c | |||
| 54092fb29b | |||
| 58e51273b8 | |||
| 093aa42e67 | |||
| ac40c95d5b | |||
| e70f0a0807 | |||
| 8a7a487dc0 | |||
| f3f8b7d194 | |||
| 0329c3284d | |||
| 325c0acd1d | |||
| 71f75283e8 | |||
| a112729931 | |||
| 389501961b | |||
| 184e4f3427 | |||
| 3400c5f77c | |||
| fd0989f764 | |||
| 108af267e7 | |||
| 649a19fd45 | |||
| f1654ace80 | |||
| bcbf14c41f | |||
| b42b34f350 | |||
| e070edc10c | |||
| ffc976683f | |||
| 3548be722e | |||
| 19bd409efa | |||
| 1a51d2ef99 | |||
| 63aab4a27b | |||
| 881109620a | |||
| 90bfb08dc5 | |||
| 9a19c67cd9 | |||
| a529f88edf | |||
| 3af5851af7 | |||
| 5d0f212040 | |||
| 791a17d3da | |||
| 80b4d3aaf4 | |||
| 9dee74e2cb | |||
| c15970a9cc | |||
| e5159abf58 | |||
| 8be0e3d16c | |||
| 9e4cd024bd | |||
| cb2ca522c6 | |||
| 006a9a1413 | |||
| 5fbfe97a59 | |||
| 0862128f60 | |||
| 9f46f7c8e5 | |||
| 2a73d29546 | |||
| 64efc15b3f | |||
| df3ab47526 | |||
| 9c14e77b10 | |||
| b512875739 | |||
| c19d1ffae8 | |||
| 923c283c22 | |||
| 1b453961e1 | |||
| 33db277af2 | |||
| d9e5f1c6df | |||
| 72a7010eee | |||
| b6e9ee5f3e | |||
| 4a792464b4 | |||
| 88728c947a | |||
| ba36ba001f | |||
| da463318c7 | |||
| 9b62d62941 | |||
| 9561fc16e7 | |||
| 8dfa8ad3e9 | |||
| 262886a6b9 | |||
| 5a6dbe5ca8 | |||
| e5b892480b | |||
| d2050ca44d | |||
| f92725b6e6 | |||
| d43851647b | |||
| 4a1d87542a | |||
| d7c42b350d | |||
| 2d130fa1cc | |||
| a6bff58793 | |||
| a285764c2c | |||
| a53f85f35c | |||
| d20ceaa161 | |||
| e21e790309 | |||
| eb604f3293 | |||
| 6b8ebba4e2 | |||
| 66cf7ec99e | |||
| 71e95fe441 | |||
| b0765fbe64 | |||
| 1a3fc3eb58 | |||
| 17c117432a | |||
| fd693fbb53 | |||
| c32ebc153f | |||
| 4400695dd7 | |||
| ceb733e28b | |||
| da2d63ef78 | |||
| e159ac8762 | |||
| b97e027920 | |||
| 7223b56db6 | |||
| 294bee54ab | |||
| b9a4c7cd8b | |||
| cc9eba99fb | |||
| 873adc5bf5 | |||
| 11b14ccf76 | |||
| 2f95c0bc9a | |||
| dd46b7f978 | |||
| 6fd0351f3e | |||
| 3a6287f5d9 | |||
| 41cecedee8 | |||
| 1b637cd5a4 | |||
| b251e0e56c | |||
| 2f01f41599 | |||
| a880355012 | |||
| aeb5f9106f | |||
| 7ce2723a09 | |||
| 47e6cbb5f7 | |||
| 8f2f19df1b | |||
| a3561d7623 | |||
| 5e2d37ed26 | |||
| 72b6845625 | |||
| 9919496397 | |||
| 33496d81ee | |||
| a1f1151c1b | |||
| b28b383136 | |||
| 0a5f8dee68 | |||
| 7a3c11c343 | |||
| 4afb977577 | |||
| 262aa4a88f | |||
| 9f61faf67a | |||
| 2f83526d7e | |||
| e64788ddb5 | |||
| 1ed5c868b5 | |||
| ecb5abaa6d | |||
| b74495117f | |||
| db67b1946f | |||
| 66a5651a30 | |||
| 2ff86a7743 | |||
| c7c9b54556 | |||
| 9b964a89f6 | |||
| c6b1bd9292 | |||
| 73a60466d3 | |||
| 49e03fb7e9 | |||
| 62a3706049 | |||
| 1914cb01fe | |||
| 09e5149090 | |||
| ac3a93370c | |||
| 859f2a99be | |||
| 4d20b4ac1c | |||
| 8135e635ab | |||
| 643e325e59 | |||
| 3c48d88357 | |||
| 15642d6e47 | |||
| 035d695780 | |||
| f9b12cbcdd | |||
| f1df4559f7 | |||
| 464e136025 | |||
| 23491b2e1a | |||
| 8a044d41fe | |||
| 7c9b8a0b6d | |||
| a0128d8f1e | |||
| fdf838c909 | |||
| b5924dceb5 | |||
| 3a623535df | |||
| 2c5ea4d7ba | |||
| 19be8591f3 | |||
| a8a741f0bf | |||
| 6865d810da | |||
| de9cf30aac | |||
| 29eeecb905 | |||
| 668d0d79e6 | |||
| 02aa1f2e45 | |||
| 52303e9185 | |||
| 7857e5992a | |||
| f9b7de63fd | |||
| 9c3a7848f3 | |||
| 6b49984c28 | |||
| 44fc60372b | |||
| 287335dc6b | |||
| cb1d280b35 | |||
| c5c4a31521 | |||
| 612b67883c | |||
| 2012ada27f | |||
| 7ad3133a15 | |||
| 0eaac5af28 | |||
| e64022a7b7 | |||
| a069b4109c | |||
| 92389bb5f5 | |||
| 032b09f0a3 | |||
| 91f26520cb | |||
| dfd915e47f | |||
| 4045771c2d | |||
| 1d3f817709 | |||
| 2e2888ec26 | |||
| c7e2773116 | |||
| 78b255fa0d | |||
| cece606bb1 | |||
| ba3ec185ef | |||
| 8b10aa655a | |||
| 13e3a69cd6 | |||
| f09d5aeceb | |||
| daca044cf3 | |||
| cb982bd38a | |||
| 69b27f0cd8 | |||
| 8617553dea | |||
| 2049cb1e02 | |||
| bdc5b0c442 | |||
| c5a5f01fa0 | |||
| c0e90a723b | |||
| 130c5dad88 | |||
| bd22e89a28 | |||
| d3722440c3 | |||
| 21c1bd9bd2 | |||
| a6dbe6de07 | |||
| 68d5a7157e | |||
| bf568fec92 | |||
| 5aa1aa6222 | |||
| c651db61ff | |||
| a2f91866f7 | |||
| 2fc9af9db4 | |||
| d6a95f78ee | |||
| 766347ad81 | |||
| 70fa74333d | |||
| 0b0b928619 | |||
| b1eeddc5bc | |||
| 74041042c5 | |||
| bfea4aa67c | |||
| b25abc19d9 | |||
| b7cfdf87b9 | |||
| 7d26975ac3 | |||
| 0177ca0f73 | |||
| 19e3e6ce0e | |||
| 2f93a8a02c | |||
| 1862d4ccf9 | |||
| 5c72771fbe | |||
| 8777ce19c1 | |||
| 64288baf54 | |||
| f8dd56b74c | |||
| db3f79da29 | |||
| 51dc0ca676 | |||
| 639230f780 | |||
| d3ae73a82d | |||
| cf3cebfcfb | |||
| 9ad062ed27 | |||
| 2469101541 | |||
| 4a3d594347 | |||
| 4ce8b22c5a | |||
| d860d6426c | |||
| 4b2b4dfade | |||
| dd9b49026b | |||
| 07cd952532 | |||
| ca5d70b37c | |||
| f8497e4388 | |||
| 150a7aa158 | |||
| 19e81a6c25 | |||
| 6e0c22d981 | |||
| 2239d39919 | |||
| d01fbbfe4b | |||
| 9e57aef8bc | |||
| 6a307e9fe3 | |||
| 26056082fa | |||
| 9cc8c40434 | |||
| 99bdaf7a24 | |||
| 4614db53cf | |||
| 36a627b737 | |||
| 6bddf1b997 | |||
| 54731f65b2 | |||
| 333d9a8c09 | |||
| 69917caed3 | |||
| adb1335c17 | |||
| 357966cf69 | |||
| 7097ef72cc | |||
| 93714ac955 | |||
| fe4fdb8607 | |||
| 6e41e73997 | |||
| ebe649c7d8 | |||
| 68f2ccb1c5 | |||
| 1d7f06b018 | |||
| 295fd88201 | |||
| 173b6d5a5d | |||
| 23a34d10b0 | |||
| 121708b71c | |||
| 403c742bf3 | |||
| 8653971dd2 | |||
| 4e40d2e8f4 | |||
| 1f09a1c603 | |||
| 1afa6bc520 | |||
| e1a72e7874 | |||
| b908c5b5bf | |||
| 43fdafc099 | |||
| 3a0011b49a | |||
| c8335b5740 | |||
| 8e5d208bbf | |||
| 01cc74ed60 | |||
| c3248cd3ec | |||
| 251268fb24 | |||
| eb4ea31cef | |||
| da379a7af9 | |||
| f278f821b6 | |||
| c8106eafa1 | |||
| e2289030db | |||
| 49314e166d | |||
| 1e347cc7d6 | |||
| 597330adb7 | |||
| 8c91be99c3 | |||
| b9f28c5ee8 | |||
| d702b5aa92 | |||
| 21a955d4d2 | |||
| 50334186f2 | |||
| 996cafeb65 | |||
| ee45baec3b | |||
| 2734a94983 | |||
| 242feffe7f | |||
| d8eefcf1b7 | |||
| 1170852209 | |||
| ec8288e6e4 | |||
| 144faa9363 | |||
| 5169174e57 | |||
| 070ffb934d | |||
| 5648f43413 | |||
| a91685747c | |||
| 665dc2d86d | |||
| a8f8c4851a | |||
| 1ad6fe93b7 | |||
| b95930dcc2 | |||
| d39a8a4e0b | |||
| 42d21c9ca1 | |||
| 74b722903f | |||
| c5867d25b5 | |||
| 8ea0ab13c0 | |||
| 4255b74f33 | |||
| 3d6aa77993 | |||
| d4373a401f | |||
| 7318e4bd7c | |||
| d193ba0b5f | |||
| 3f1165f323 | |||
| f3ad5d8b06 | |||
| c5e4a70ec0 | |||
| 17aa1cf51e | |||
| 6dd6622b35 | |||
| 8f2e99863d | |||
| 38d3592461 | |||
| 7813cf744b | |||
| 1c0be4f96f | |||
| 4c33167764 | |||
| 99e9bf51a6 | |||
| 5f03a3dfda | |||
| 0b6ce06c96 | |||
| 67fbc2589f | |||
| 57688a5310 | |||
| 944f92f3b0 | |||
| ad266dd14f | |||
| 722748aba4 | |||
| ad26a70aed | |||
| 159c4a6ce1 | |||
| ce7ba82bda | |||
| 955fa05666 | |||
| e18368e647 | |||
| b6420b7b8a | |||
| 078205b552 | |||
| 2b7b12fde7 | |||
| 5605a88846 | |||
| f46a03e66d | |||
| 26f3057bbe | |||
| c7d8d0c5cc | |||
| a06efc5736 | |||
| 35e4e8ef95 | |||
| 95ca383215 | |||
| d1495534e0 | |||
| 514711c5c2 | |||
| c8e3dfd873 | |||
| 108899c796 | |||
| 1fb9977094 | |||
| ca901b14f3 | |||
| fcaacfbb5d | |||
| 2d0732c218 | |||
| 20702a47f8 | |||
| 5e876f07fb | |||
| e235165499 | |||
| c476c9a938 | |||
| 1fa4e1cd9c | |||
| 52633ef695 | |||
| 2147452125 | |||
| 57194b5dd3 | |||
| 8335c458ed | |||
| aed64581c9 | |||
| e6e46c84e7 | |||
| 4686e5040e | |||
| 953b07497d | |||
| 17e9f8e52f | |||
| 31565ff6dd | |||
| 2f1f6f9631 | |||
| 3171c32283 | |||
| 4076fff844 | |||
| 87e6b029e2 | |||
| 3e0443927c | |||
| ef7cbf853b | |||
| c9d8875392 | |||
| d7de7b0778 | |||
| 40279095a3 | |||
| 324d4774f3 | |||
| 405afd0cf1 | |||
| b1734e169b | |||
| 02ba5d75d1 | |||
| e491172b28 | |||
| 3f876a0b81 | |||
| 8aa7751060 | |||
| 22deda2aea | |||
| 2143660cf6 | |||
| e5004e762a | |||
| 720346e8e3 | |||
| bc85572610 | |||
| 8815319577 | |||
| 38abbe22a7 | |||
| aac17468c3 | |||
| 94cf67a47f | |||
| 120e46f994 | |||
| af6780b36c | |||
| d2f5b77f16 | |||
| db3ada3830 | |||
| 552ef89cd7 | |||
| 5ee6a2c97e | |||
| dd65b1fd88 | |||
| 96a1faf97a | |||
| 673a903c75 | |||
| c588936f00 | |||
| 1453140005 | |||
| 7e68ec5948 | |||
| 7e878c00b2 | |||
| 51d4f988cc | |||
| 78126f6549 | |||
| 8833999e8d | |||
| b4bddaea6a | |||
| 9ee559fd2f | |||
| 3151d95ec2 | |||
| 234006783c | |||
| 1146929beb | |||
| 1d969e5c9f | |||
| ce753ef926 | |||
| 42b213922c | |||
| 3119005688 | |||
| 84e1bc8d27 | |||
| 0b5741de7c | |||
| 56c828f387 | |||
| ef2649c3fd | |||
| 9e0ff7501e | |||
| 9a98ffd6e6 | |||
| 667a2ab679 | |||
| e4f6295597 | |||
| 1063c95fc0 | |||
| b036e2ce32 | |||
| a3962da518 | |||
| e2c8cb0f7c | |||
| 3d80216780 | |||
| d205fb7c6b | |||
| 7ad551238d | |||
| 889ad57adc | |||
| 44c5595173 | |||
| 77c284c9b4 | |||
| 2364edb684 | |||
| 3cb756a42f | |||
| 8b1114dc7f | |||
| 75df199c5d | |||
| 5d80eacb3f | |||
| 6d31cbe33e | |||
| 0ac3414a95 | |||
| e3e21d2b1e | |||
| 79d89b9718 | |||
| 1741d6cd60 | |||
| 6c748a8a2d | |||
| efa327fb48 | |||
| b110fd063c | |||
| fdb1fe77db | |||
| 0c78f0af7a | |||
| 4a12aad3dc | |||
| 745474a37f |
42
.editorconfig
Normal file
42
.editorconfig
Normal file
@ -0,0 +1,42 @@
|
||||
# Indica que este es el archivo de configuración raíz
|
||||
root = true
|
||||
|
||||
# Configuración global para todos los archivos
|
||||
[*]
|
||||
charset = utf-8 # Codificación UTF-8
|
||||
end_of_line = lf # Saltos de línea tipo Unix (LF)
|
||||
trim_trailing_whitespace = true # Eliminar espacios en blanco finales
|
||||
insert_final_newline = true # Asegura una nueva línea al final del archivo
|
||||
|
||||
# Configuración para archivos PHP
|
||||
[*.php]
|
||||
indent_style = space # Usar espacios en lugar de tabulaciones
|
||||
indent_size = 4 # Tamaño de indentación de 4 espacios
|
||||
|
||||
# Configuración para archivos JavaScript
|
||||
[*.js]
|
||||
indent_style = space # Usar espacios en lugar de tabulaciones
|
||||
indent_size = 2 # Tamaño de indentación de 2 espacios
|
||||
quote_type = single # Usar comillas simples por defecto
|
||||
trim_trailing_whitespace = true # Eliminar espacios en blanco finales
|
||||
|
||||
# Configuración para archivos de estilos CSS
|
||||
[*.css]
|
||||
indent_style = space # Usar espacios en lugar de tabulaciones
|
||||
indent_size = 2 # Tamaño de indentación de 2 espacios
|
||||
|
||||
# Configuración para archivos JSON
|
||||
[*.json]
|
||||
indent_style = space # Usar espacios en lugar de tabulaciones
|
||||
indent_size = 2 # Tamaño de indentación de 2 espacios
|
||||
|
||||
# Configuración para archivos de vista (HTML y Blade)
|
||||
[*.{html,blade.php}]
|
||||
indent_style = space # Usar espacios en lugar de tabulaciones
|
||||
indent_size = 4 # Tamaño de indentación de 4 espacios
|
||||
trim_trailing_whitespace = true # Eliminar espacios en blanco finales
|
||||
|
||||
# Configuración para archivos Markdown
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false # No eliminar espacios en blanco finales
|
||||
insert_final_newline = false # No agregar una nueva línea al final del archivo
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
ci4/.env
|
||||
.vscode/
|
||||
|
||||
./xdebug.log
|
||||
launch.json
|
||||
*xdebug*.log*
|
||||
ci4/app/Config/RBAC/*
|
||||
44
.idea/deployment.xml
generated
44
.idea/deployment.xml
generated
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" autoUpload="Always" serverName="SK-IMN" remoteFilesAllowedToDisappearOnAutoupload="false" confirmBeforeUploading="false">
|
||||
<option name="confirmBeforeUploading" value="false" />
|
||||
<serverData>
|
||||
<paths name="ERP-DEMO">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
<paths name="SK-DEV">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
<paths name="SK-IMN">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping deploy="/" local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
<paths name="SK-JJO">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping deploy="/" local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
<paths name="SK-MAIN">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping deploy="/" local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
</serverData>
|
||||
<option name="myAutoUpload" value="ALWAYS" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/inspectionProfiles/Project_Default.xml
generated
6
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,6 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/safekat.iml" filepath="$PROJECT_DIR$/.idea/safekat.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
74
.idea/php.xml
generated
74
.idea/php.xml
generated
@ -1,74 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/psr/log" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/psr/container" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/nikic/php-parser" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phenx/php-svg-lib" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phenx/php-font-lib" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/dompdf/dompdf" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/laminas/laminas-escaper" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/myclabs/deep-copy" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phar-io/version" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phar-io/manifest" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phpunit/phpunit" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phpunit/php-timer" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phpunit/php-invoker" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phpunit/php-code-coverage" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phpunit/php-file-iterator" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phpunit/php-text-template" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/symfony/deprecation-contracts" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/theseer/tokenizer" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/doctrine/instantiator" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/fakerphp/faker" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/mikey179/vfsstream" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/diff" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/type" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/version" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/exporter" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/code-unit" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/cli-parser" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/comparator" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/complexity" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/environment" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/global-state" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/lines-of-code" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/object-reflector" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/object-enumerator" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/recursion-context" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/resource-operations" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sebastian/code-unit-reverse-lookup" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/sabberworm/php-css-parser" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/masterminds/html5" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/codeigniter4/shield" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/codeigniter4/settings" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/codeigniter4/framework" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.2">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpUnit">
|
||||
<phpunit_settings>
|
||||
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/ci4/vendor/autoload.php" />
|
||||
</phpunit_settings>
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/phpunit.xml
generated
10
.idea/phpunit.xml
generated
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PHPUnit">
|
||||
<option name="directories">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/ci4/tests" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
14
.idea/safekat.iml
generated
14
.idea/safekat.iml
generated
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/app" isTestSource="false" packagePrefix="App\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/app/Config" isTestSource="false" packagePrefix="Config\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/app/ThirdParty/DatatablesEditor/" isTestSource="false" packagePrefix="DataTables\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/tests/_support" isTestSource="true" packagePrefix="Tests\Support\" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
51
.idea/webServers.xml
generated
51
.idea/webServers.xml
generated
@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="WebServers">
|
||||
<option name="servers">
|
||||
<webServer id="b340ea2c-6cfa-4862-a020-5d4f6e482cc1" name="SK-MAIN" url="http://sk-main.imnavajas.es">
|
||||
<fileTransfer host="sk-main.imnavajas.es" port="21">
|
||||
<advancedOptions>
|
||||
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
|
||||
</advancedOptions>
|
||||
</fileTransfer>
|
||||
</webServer>
|
||||
<webServer id="c01b8916-f9bb-46f4-a585-5f4f4064aa87" name="SK-IMN" url="http://sk-imn.imnavajas.es">
|
||||
<fileTransfer host="sk-imn.imnavajas.es" port="21">
|
||||
<advancedOptions>
|
||||
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
|
||||
</advancedOptions>
|
||||
</fileTransfer>
|
||||
</webServer>
|
||||
<webServer id="36de594c-5db8-413e-b1a1-cd035ebed2f1" name="SK-JJO" url="http://sk-jjo.imnavajas.es">
|
||||
<fileTransfer host="sk-jjo.imnavajas.es" port="21">
|
||||
<advancedOptions>
|
||||
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
|
||||
</advancedOptions>
|
||||
</fileTransfer>
|
||||
</webServer>
|
||||
<webServer id="85f139d9-24ee-421b-b3fa-c8b68aa8f4ef" name="SK-DEV" url="http://sk-dev.imnavajas.es">
|
||||
<fileTransfer host="sk-dev.imnavajas.es" port="21">
|
||||
<advancedOptions>
|
||||
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
|
||||
</advancedOptions>
|
||||
</fileTransfer>
|
||||
</webServer>
|
||||
<webServer id="94314164-bdb5-40a0-a28a-8d8dc3915eed" name="ERP-DEMO" url="http://erp.safekat.es">
|
||||
<fileTransfer host="erp.safekat.es" port="21">
|
||||
<advancedOptions>
|
||||
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
|
||||
</advancedOptions>
|
||||
</fileTransfer>
|
||||
</webServer>
|
||||
</option>
|
||||
<groups>
|
||||
<group>
|
||||
<name>DEV/UI</name>
|
||||
<servers>
|
||||
<name value="SK-MAIN" />
|
||||
<name value="SK-IMN" />
|
||||
</servers>
|
||||
</group>
|
||||
</groups>
|
||||
</component>
|
||||
</project>
|
||||
188
.idea/workspace.xml
generated
188
.idea/workspace.xml
generated
@ -1,188 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="7c8f7059-cd40-417c-936e-48dbc0507d86" name="Changes" comment="Add static Vuexy files">
|
||||
<<<<<<< HEAD
|
||||
<change afterPath="$PROJECT_DIR$/ci4/app/Controllers/Compras/Compras.php" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ci4/app/Controllers/Compras/Productos.php" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ci4/app/Controllers/Importacion/Importar.php" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/.env" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/.env" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Catalogo/Catalogo.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Catalogo/Catalogo.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Envioslogistica/Logistica.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Envioslogistica/Logistica.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Facturacion/Factura.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Facturacion/Factura.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Pedidos/Pedido.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Pedidos/Pedido.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Produccion/Ordentrabajo.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Produccion/Ordentrabajo.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Proveedores/Proveedor.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Compras/Proveedor.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Filters/LoginAuthFilter.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Filters/LoginAuthFilter.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Language/en/App.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/en/App.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Language/es/App.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/es/App.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/settings/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/settings/index.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/all.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/all.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php" afterDir="false" />
|
||||
=======
|
||||
<change beforePath="$PROJECT_DIR$/.idea/webServers.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/webServers.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Language/en/Users.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/en/Users.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Language/es/Users.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/es/Users.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisForm.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisForm.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisList.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisList.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelGenericoForm.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelGenericoForm.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/configuracion/papel/viewPapelImpresionForm.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/user/_userFormItems.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/form/user/_userFormItems.php" afterDir="false" />
|
||||
>>>>>>> 38e9feb4c8537689e5d266a1dbe3371003d2457f
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ComposerSettings" doNotAsk="true" synchronizationState="SYNCHRONIZE">
|
||||
<pharConfigPath>$PROJECT_DIR$/ci4/composer.json</pharConfigPath>
|
||||
<execution />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2OsCE3jXyiqpYISC6WI6TMJusA2" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"last_opened_file_path": "C:/temp-sk/safekat/ci4/app/Views/themes/backend/vuexy/main",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\temp-sk\safekat\ci4\app\Views\themes\backend\vuexy\main" />
|
||||
<recent name="C:\temp-sk\safekat\ci4\app\Views\themes\backend\vuexy\form\settings" />
|
||||
<recent name="C:\temp-sk\safekat\ci4\app\Views\themes\backend\vuexy\form\profile" />
|
||||
<recent name="D:\Safekat\safekat\ci4\app\Views\themes\_commonPartialsBs" />
|
||||
<recent name="C:\temp-sk\safekat\httpdocs\themes\vuexy\vendor\libs\toastr" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\temp-sk\safekat\ci4\app\Controllers\Usuarios" />
|
||||
<recent name="C:\temp-sk\safekat\ci4" />
|
||||
<recent name="C:\temp-sk\safekat\httpdocs\themes\vuexy" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="7c8f7059-cd40-417c-936e-48dbc0507d86" name="Changes" comment="" />
|
||||
<created>1682339793915</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1682339793915</updated>
|
||||
<workItem from="1682339796150" duration="1274000" />
|
||||
<workItem from="1682412462416" duration="9540000" />
|
||||
<workItem from="1682492106609" duration="7922000" />
|
||||
<workItem from="1683530628259" duration="12043000" />
|
||||
<workItem from="1683618855414" duration="183000" />
|
||||
<workItem from="1683619057531" duration="16014000" />
|
||||
<workItem from="1683715799575" duration="151000" />
|
||||
<workItem from="1683716769681" duration="8512000" />
|
||||
<workItem from="1683796910193" duration="12918000" />
|
||||
<workItem from="1684147458134" duration="7379000" />
|
||||
<workItem from="1684221025785" duration="2261000" />
|
||||
<workItem from="1684226343116" duration="4598000" />
|
||||
<workItem from="1684236911941" duration="2213000" />
|
||||
<workItem from="1684239429024" duration="2049000" />
|
||||
<workItem from="1684313352573" duration="9284000" />
|
||||
<workItem from="1684350581362" duration="2244000" />
|
||||
<workItem from="1684415370137" duration="889000" />
|
||||
<workItem from="1684761592479" duration="626000" />
|
||||
<workItem from="1684829967827" duration="8241000" />
|
||||
<workItem from="1684869825991" duration="3082000" />
|
||||
<workItem from="1684910640450" duration="14817000" />
|
||||
<workItem from="1685018778974" duration="1905000" />
|
||||
<workItem from="1685038598644" duration="6958000" />
|
||||
<workItem from="1685102978387" duration="3272000" />
|
||||
<workItem from="1685266094611" duration="3469000" />
|
||||
<<<<<<< HEAD
|
||||
<workItem from="1685365444846" duration="191000" />
|
||||
<workItem from="1685689980219" duration="12098000" />
|
||||
=======
|
||||
<workItem from="1685564762632" duration="2787000" />
|
||||
>>>>>>> 38e9feb4c8537689e5d266a1dbe3371003d2457f
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Starting Vuexy Theme creation">
|
||||
<created>1682339938559</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682339938559</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00002" summary="Add static Vuexy files">
|
||||
<created>1682420504675</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682420504675</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="3" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State>
|
||||
<option name="FILTERS">
|
||||
<map>
|
||||
<entry key="branch">
|
||||
<value>
|
||||
<list>
|
||||
<option value="origin/dev/vuexy" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</State>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<MESSAGE value="Starting Vuexy Theme creation" />
|
||||
<MESSAGE value="Add static Vuexy files" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Add static Vuexy files" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="php">
|
||||
<url>file://$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/all.php</url>
|
||||
<line>371</line>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -1,5 +1,4 @@
|
||||
{
|
||||
"clockify.tracking.workspaceId": "6464949facab6237e1538c14",
|
||||
"sqltools.connections": [
|
||||
{
|
||||
"mysqlOptions": {
|
||||
|
||||
22
.vscode/sftp.json
vendored
22
.vscode/sftp.json
vendored
@ -5,18 +5,34 @@
|
||||
"remotePath": "/",
|
||||
"uploadOnSave": true,
|
||||
"useTempFile": false,
|
||||
"openSsh": false,
|
||||
"openSsh": false,
|
||||
"profiles": {
|
||||
"jjo": {
|
||||
"jjo": {
|
||||
"host": "sk-jjo.imnavajas.es",
|
||||
"username": "sk-jjo",
|
||||
"password": "Snwi1660%"
|
||||
|
||||
|
||||
},
|
||||
"imn": {
|
||||
"host": "sk-imn.imnavajas.es",
|
||||
"username": "sk-imn",
|
||||
"password": "GVBbgdwlvn7_p02?"
|
||||
|
||||
},
|
||||
"dev":{
|
||||
"host": "sk-dev.imnavajas.es",
|
||||
"username": "sk-dev",
|
||||
"password": "KXvYsubai9v*g61~"
|
||||
},
|
||||
"sk-prod":{
|
||||
"host": "erp.safekat.es",
|
||||
"username": "erp-demo",
|
||||
"password": "lNkEyukTc1~*3yy9"
|
||||
},
|
||||
"sk-dev":{
|
||||
"host": "erp-dev.safekat.es",
|
||||
"username": "erp-dev",
|
||||
"password": "snqyxNZIhg8m3!9~"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
133
acciones.txt
133
acciones.txt
@ -1,133 +0,0 @@
|
||||
Quitar Oauth
|
||||
---------------------------------------------
|
||||
Quitar packete con composer que se usa en la Oauth
|
||||
composer remove hybridauth/hybridauth
|
||||
Tablas en la BBDD.
|
||||
wg_user_oauth
|
||||
wg_settings_oauth
|
||||
Se hace migración (hay que añadir el controlador Migrate a whiteListController)
|
||||
Modelos
|
||||
UserOauthModel.php
|
||||
SettingsOauthModel.php
|
||||
Controllers
|
||||
Oauth.php
|
||||
Realizar busqueda de UserOauthModel que está en varios Controllers
|
||||
Buscar la variable que crea en cada controlador y ver para que la usa
|
||||
Igual que la acción anterior pero con SettingsOauthModel
|
||||
Está en el controlador Settings.php. Buscar la variable que crea y borrarla
|
||||
Eliminar Views\themes\backend\focus2\form\settings\oauth.php
|
||||
En Views\themes\backend\focus2\main\menu.
|
||||
Quitar la línea php que invoca a la configuración de Oauth (site_url("settings/oauth"))
|
||||
En Views\themes\frontend\tivo\main\menu.php
|
||||
Quitar la línea php que invoca a la configuración de Oauth (site_url("settings/oauth"))
|
||||
En en controlador Settings.php
|
||||
Quitar las funciones oauth() y oauth_store()
|
||||
En los idiomas quitar la key dashboard_chart_auth
|
||||
En la vista quitar la carta de Solcial autenthification
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title"><?=lang("App.dashboard_chart_auth")?></h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-12" id="ct-icon-chart"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12"><div class="ct-pie-chart"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Quitar los SMS
|
||||
--------------------------------------------
|
||||
Quitar packete con composer que se usa en la Oauth
|
||||
twilio/sdk
|
||||
Dentro de Controllers\Integration.php
|
||||
Eliminar sendSMS (public y private)
|
||||
Se hace migración de la BBDD
|
||||
Del controlador Cron.php se elimina
|
||||
la accion // Cron Notification SMS
|
||||
la función test()
|
||||
Del controlador Ajax.php
|
||||
linea 368, quitar is_send_sms de la lista
|
||||
linea 399, eliminar "is_send_sms"=>$record['is_send_sms'],
|
||||
Del controlador Login.php eliminar
|
||||
//Notification SMS User Welcome
|
||||
//SMS Account Confirmation
|
||||
Dentro de //Notification New Register, las dos líneas is_send_sms y send_sms_notification
|
||||
linea 455 if($settings['send_sms_register']??false){ quitar if completo
|
||||
Del controlador Notification.php
|
||||
linea 117 , 148, 150
|
||||
Del controlador Settings.php
|
||||
linea 106, 109
|
||||
De los idiomas, quitar los registros
|
||||
settings_field_send_sms_register
|
||||
notification_field_send_sms
|
||||
Del modelo NotificationModel.php
|
||||
Quitar los fields is_send_sms y send_sms_notification
|
||||
Del modelo SettingsModel.php
|
||||
Quitar los fields send_sms_register y send_sms_welcome
|
||||
sms_gateway, sms_account_id, ,sms_auth_token, sms_info_add, sms_confirmation
|
||||
De la vista Views\themes\backend\focus2\form\notification\form quitar
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label class="text-dark"><?=lang("App.notification_field_send_sms")?></label>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" id="send_sms_notification" name="send_sms_notification" class="custom-control-input" <?= $obj['send_sms_notification']??false ? 'checked' : ''?>>
|
||||
<label for="send_sms_notification" class="custom-control-label"><?=lang("App.notification_field_send_label")?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
De la vista Views\themes\backend\focus2\form\notification\index.php quitar de la linea 129 { data: 'is_send_sms' },
|
||||
De la vista Views\themes\backend\focus2\form\settings\index.php quitar los siguientes bloques
|
||||
<div class="col-lg-3">
|
||||
<div class="form-group">
|
||||
<label class="text-dark"><?=lang("App.settings_field_send_welcome_message_sms")?></label>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" id="send_sms_welcome" name="send_sms_welcome" class="custom-control-input" <?= $obj['send_sms_welcome']??false ? 'checked' : ''?>>
|
||||
<label for="send_sms_welcome" class="custom-control-label"><?=lang("App.global_activate")?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
y
|
||||
<div class="col-lg-3">
|
||||
<div class="form-group">
|
||||
<label class="text-dark"><?=lang("App.settings_field_send_sms_register")?></label>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" id="send_sms_register" name="send_sms_register" class="custom-control-input" <?= $obj['send_sms_register']??false ? 'checked' : ''?>>
|
||||
<label for="send_sms_register" class="custom-control-label"><?=lang("App.global_activate")?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
En el controlador Ajax.php quitar if($records[$key]['sms_confirmed'] == 1)
|
||||
En el controlador Login.php quitar
|
||||
bloque // Check sms confirmed
|
||||
if($confirmation['type'] == 'sms')
|
||||
En el controlador Settings.php quitar
|
||||
linea 104
|
||||
case 'sms;
|
||||
En el controlador User.php quitar linea 217 y 236
|
||||
Del modelo UserModel.php quitar el campo sms_confirmed
|
||||
En los idiomas buscar la key sms
|
||||
En la vista Views\themes\backend\focus2\form\notification\index.php quitar linea 49
|
||||
En la vista Views\themes\backend\focus2\form\settings\index.php quitar
|
||||
linea 37
|
||||
bloque en linea 298
|
||||
linea 355
|
||||
bloque en linea 679
|
||||
linea 1033
|
||||
En la vista Views\themes\backend\focus2\form\settings\template.php
|
||||
bloque linea 87 hasta 131
|
||||
En la vista Views\themes\backend\focus2\form\user\form.php
|
||||
bloque linea 104 hasta 113
|
||||
linea 210
|
||||
|
||||
|
||||
Renombrar tablas a auth_ en lugar de wg_
|
||||
-------------------------------------------------
|
||||
La tabla wg_migrations hay que modificarla a mano.
|
||||
En .env quitar el prefijo: database.default.DBPrefix =
|
||||
En todos los modelos añadir auth_ al principio del nombre de la tabla
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
55
ci4/app/Commands/CatalogoLibroAsignarIskn.php
Normal file
55
ci4/app/Commands/CatalogoLibroAsignarIskn.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use CodeIgniter\CLI\BaseCommand;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
use Config\Database;
|
||||
use App\Models\Catalogo\IdentificadorIsknModel;
|
||||
|
||||
class CatalogoLibroAsignarIskn extends BaseCommand
|
||||
{
|
||||
protected $group = 'custom';
|
||||
protected $name = 'catalogo:libro-asignar-iskn';
|
||||
protected $description = 'Asigna ISKN directamente en la base de datos a los libros que no lo tienen.';
|
||||
|
||||
public function run(array $params)
|
||||
{
|
||||
$db = Database::connect();
|
||||
$modelISKN = new IdentificadorIsknModel();
|
||||
|
||||
// Obtener todos los libros sin ISKN
|
||||
$libros = $db->table('catalogo_libros')
|
||||
->select('id')
|
||||
->where('iskn IS NULL')
|
||||
->where('deleted_at IS NULL')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (empty($libros)) {
|
||||
CLI::write('No hay libros sin ISKN por asignar.', 'green');
|
||||
return;
|
||||
}
|
||||
|
||||
CLI::write('Asignando ISKN a ' . count($libros) . ' libros...', 'yellow');
|
||||
|
||||
$i = 1;
|
||||
foreach ($libros as $libro) {
|
||||
$iskn = $modelISKN->newIskn();
|
||||
|
||||
if ($iskn !== null) {
|
||||
$db->table('catalogo_libros')
|
||||
->where('id', $libro['id'])
|
||||
->update(['iskn' => $iskn]);
|
||||
|
||||
CLI::write("[{$i}] ISKN '{$iskn}' asignado a libro ID {$libro['id']}", 'cyan');
|
||||
} else {
|
||||
CLI::error("[{$i}] No se pudo generar ISKN para libro ID {$libro['id']}");
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
CLI::write('Proceso finalizado.', 'green');
|
||||
}
|
||||
}
|
||||
204
ci4/app/Commands/CatalogoLibroImportar.php
Normal file
204
ci4/app/Commands/CatalogoLibroImportar.php
Normal file
@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use CodeIgniter\CLI\BaseCommand;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
|
||||
class CatalogoLibroImportar extends BaseCommand
|
||||
{
|
||||
protected $group = 'custom';
|
||||
protected $name = 'catalogo:libro-importar';
|
||||
protected $description = 'Importa los registros de catalogo_libro a catalogo_libros para un customer_id dado';
|
||||
|
||||
public function run(array $params)
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
$totalImportados = 0;
|
||||
|
||||
// Al inicio del método run()
|
||||
$papeles = $db->table('lg_papel_generico')
|
||||
->select('id, code')
|
||||
->where('is_deleted', 0)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// Mapa code => id
|
||||
$papelMap = [];
|
||||
foreach ($papeles as $p) {
|
||||
if (!empty($p['code'])) {
|
||||
$papelMap[trim($p['code'])] = $p['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Mapa de acabados => id
|
||||
$acabadosMap = [
|
||||
'plastificado_brillo' => 1,
|
||||
'plastificado_mate' => 5,
|
||||
];
|
||||
|
||||
// Mapa de encuadernaciones => id
|
||||
$encuadernacionMap = [
|
||||
'RCHV' => 4, // cosido tapa blanda
|
||||
'RCHVS' => 20, // cosido tapa blanda solapas
|
||||
'RDF' => 1, // fresado tapa dura
|
||||
'RF' => 2, // fresado tapa blanda
|
||||
'RFS' => 2, // fresado tapa blanda solapas
|
||||
'TDC' => 3, // cosido tapa dura
|
||||
];
|
||||
|
||||
|
||||
if (empty($params[0]) || !is_numeric($params[0])) {
|
||||
CLI::error('Debes proporcionar un customer_id válido como parámetro.');
|
||||
return;
|
||||
}
|
||||
|
||||
$customerId = (int) $params[0];
|
||||
CLI::write("Iniciando importación para customer_id = $customerId ...", 'yellow');
|
||||
|
||||
$libros = $db->table('catalogo_libro_antiguo_erp')
|
||||
->where('customer_id', $customerId)
|
||||
->where('deleted_at', null)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (empty($libros)) {
|
||||
CLI::write('No se encontraron registros para importar.', 'red');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($libros as $libro) {
|
||||
$nuevoLibro = [
|
||||
'id' => $libro['id'],
|
||||
'cliente_id' => $libro['customer_id'],
|
||||
'proveedor_id' => null,
|
||||
'user_created_id' => 1,
|
||||
'user_update_id' => 1,
|
||||
'cubierta_archivo' => $libro['cover_file'],
|
||||
'cubierta_url' => $libro['cover_url'],
|
||||
'ancho' => $libro['ancho'],
|
||||
'alto' => $libro['alto'],
|
||||
'peso' => $libro['peso'],
|
||||
'titulo' => $libro['titulo'],
|
||||
'autor' => $libro['autor'] ?? null,
|
||||
'autor_entidad' => $libro['autor_entidad'],
|
||||
'traductor' => $libro['traductor'],
|
||||
'ilustrador' => $libro['ilustrador'],
|
||||
'idioma' => $libro['idioma'],
|
||||
'num_edic' => $libro['num_edic'],
|
||||
'fecha_disponibilidad' => $libro['fecha_disponibilidad'],
|
||||
'fecha_public' => $libro['fecha_public'],
|
||||
'num_fotos' => $libro['num_fotos'],
|
||||
'num_ilustr' => $libro['num_ilustr'],
|
||||
'num_ilustr_color' => $libro['num_ilustr_color'],
|
||||
'num_ilustr_bn' => $libro['num_ilustr_bn'],
|
||||
'coleccion' => $libro['coleccion'] ?? null,
|
||||
'isbn' => $libro['isbn'],
|
||||
'ean' => $this->generarEAN($libro['isbn']),
|
||||
'editorial' => $libro['editorial'],
|
||||
'resumen' => $libro['resumen'],
|
||||
'resumen_breve' => $libro['resumen_breve'],
|
||||
'sello' => $libro['sello'],
|
||||
'paginas' => $libro['paginas'],
|
||||
'tipo_impresion' => $this->mapTipoImpresion($libro['tipo_impresion']),
|
||||
'comentarios' => $libro['comentarios'],
|
||||
|
||||
'negro_paginas' => $libro['negro_paginas'],
|
||||
'negro_papel_id' => $this->getPapelId($libro['negro_papel'], $papelMap),
|
||||
'negro_gramaje' => $libro['negro_gramaje'],
|
||||
'negro_pod_papel_id' => $this->getPapelId($libro['negro_papel'], $papelMap),
|
||||
'negro_pod_gramaje' => $libro['negro_gramaje'],
|
||||
|
||||
'color_paginas' => $libro['color_paginas'],
|
||||
'color_papel_id' => $this->getPapelId($libro['color_papel'], $papelMap),
|
||||
'color_gramaje' => $libro['color_gramaje'],
|
||||
'color_pod_papel_id' => $this->getPapelId($libro['color_papel'], $papelMap),
|
||||
'color_pod_gramaje' => $libro['color_gramaje'],
|
||||
|
||||
'cubierta_paginas' => $libro['portada_paginas'],
|
||||
'cubierta_papel_id' => $this->getPapelId($libro['portada_papel'], $papelMap),
|
||||
'cubierta_gramaje' => $libro['portada_gramaje'],
|
||||
'cubierta_pod_papel_id' => $this->getPapelId($libro['portada_papel'], $papelMap),
|
||||
'cubierta_pod_gramaje' => $libro['portada_gramaje'],
|
||||
'cubierta_acabado_id' => $this->getAcabadoId($libro['portada_acabado'], $acabadosMap),
|
||||
'cubierta_ancho_solapas' => $libro['solapas_ancho'],
|
||||
|
||||
'sobrecubierta_paginas' => $libro['cubierta_paginas'],
|
||||
'sobrecubierta_papel_id' => $this->getPapelId($libro['cubierta_papel'], $papelMap),
|
||||
'sobrecubierta_gramaje' => $libro['cubierta_gramaje'],
|
||||
'sobrecubierta_pod_papel_id' => $this->getPapelId($libro['cubierta_papel'], $papelMap),
|
||||
'sobrecubierta_pod_gramaje' => $libro['cubierta_gramaje'],
|
||||
'sobrecubierta_acabado_id' => $this->getAcabadoId($libro['cubierta_acabado'], $acabadosMap),
|
||||
'sobrecubierta_ancho_solapas' => 0,
|
||||
|
||||
'encuadernacion_id' => $this->getEncuadernacionId($libro['encuardenacion'], $encuadernacionMap),
|
||||
|
||||
'ubicacion' => $libro['ubicacion'],
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'deleted_at' => $libro['deleted_at'],
|
||||
'iskn' => null,
|
||||
];
|
||||
|
||||
$exists = $db->table('catalogo_libros')
|
||||
->where('id', $libro['id'])
|
||||
->countAllResults();
|
||||
|
||||
if ($exists == 0) {
|
||||
$db->table('catalogo_libros')->insert($nuevoLibro);
|
||||
$totalImportados++;
|
||||
}else{
|
||||
CLI::write("El libro con ISBN " . $libro['isbn'] . " ya existe para el cliente con id " . $customerId . ".", 'yellow');
|
||||
}
|
||||
}
|
||||
|
||||
CLI::write("Importación finalizada. Se insertaron " . $totalImportados . " registros.", 'green');
|
||||
}
|
||||
|
||||
private function mapTipoImpresion($tipo)
|
||||
{
|
||||
switch ($tipo) {
|
||||
case 'bn':
|
||||
return 'negro';
|
||||
case 'color':
|
||||
return 'color';
|
||||
case 'colorfoto':
|
||||
return 'colorhq';
|
||||
case 'bicolor':
|
||||
return 'color';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private function getPapelId(?string $code, array $map): ?int
|
||||
{
|
||||
if ($code === null)
|
||||
return null;
|
||||
$code = trim($code);
|
||||
return $map[$code] ?? null;
|
||||
}
|
||||
|
||||
private function getAcabadoId(?string $nombre, array $map): ?int
|
||||
{
|
||||
if ($nombre === null)
|
||||
return null;
|
||||
$nombre = trim($nombre);
|
||||
return $map[$nombre] ?? null;
|
||||
}
|
||||
private function getEncuadernacionId(?string $codigo, array $map): ?int
|
||||
{
|
||||
if ($codigo === null)
|
||||
return null;
|
||||
$codigo = trim($codigo);
|
||||
return $map[$codigo] ?? null;
|
||||
}
|
||||
|
||||
private function generarEAN(?string $isbn): ?string
|
||||
{
|
||||
if ($isbn === null)
|
||||
return null;
|
||||
return str_replace('-', '', $isbn);
|
||||
}
|
||||
|
||||
}
|
||||
17
ci4/app/Config/Auth.php
Normal file → Executable file
17
ci4/app/Config/Auth.php
Normal file → Executable file
@ -13,7 +13,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Config;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Shield\Authentication\Authenticators\JWT;
|
||||
use CodeIgniter\Shield\Authentication\Passwords\ValidationRules;
|
||||
use CodeIgniter\Shield\Config\Auth as ShieldAuth;
|
||||
use CodeIgniter\Shield\Authentication\Actions\ActionInterface;
|
||||
@ -117,7 +118,7 @@ class Auth extends ShieldAuth
|
||||
'tokens' => AccessTokens::class,
|
||||
'session' => Session::class,
|
||||
'hmac' => HmacSha256::class,
|
||||
// 'jwt' => JWT::class,
|
||||
'jwt' => JWT::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@ -144,7 +145,7 @@ class Auth extends ShieldAuth
|
||||
'session',
|
||||
'tokens',
|
||||
'hmac',
|
||||
// 'jwt',
|
||||
'jwt',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -438,8 +439,14 @@ class Auth extends ShieldAuth
|
||||
public function loginRedirect(): string
|
||||
{
|
||||
$session = session();
|
||||
$url = $session->getTempdata('beforeLoginUrl') ?? setting('Auth.redirects')['login'];
|
||||
|
||||
$url = setting('Auth.redirects')['login'];
|
||||
if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])){
|
||||
if($_SERVER['HTTP_X_REQUESTED_WITH'] == "xmlhttprequest"){
|
||||
$url = setting('Auth.redirects')['login'];
|
||||
}
|
||||
}else{
|
||||
$url = $session->getTempdata('beforeLoginUrl') ?? setting('Auth.redirects')['login'];
|
||||
}
|
||||
return $this->getUrl($url);
|
||||
}
|
||||
|
||||
|
||||
0
ci4/app/Config/AuthGroups.php
Normal file → Executable file
0
ci4/app/Config/AuthGroups.php
Normal file → Executable file
96
ci4/app/Config/AuthJWT.php
Executable file
96
ci4/app/Config/AuthJWT.php
Executable file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of CodeIgniter Shield.
|
||||
*
|
||||
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Shield\Config\AuthJWT as ShieldAuthJWT;
|
||||
|
||||
/**
|
||||
* JWT Authenticator Configuration
|
||||
*/
|
||||
class AuthJWT extends ShieldAuthJWT
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------
|
||||
* Name of Authenticator Header
|
||||
* --------------------------------------------------------------------
|
||||
* The name of Header that the Authorization token should be found.
|
||||
* According to the specs, this should be `Authorization`, but rare
|
||||
* circumstances might need a different header.
|
||||
*/
|
||||
public string $authenticatorHeader = 'Authorization';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------
|
||||
* The Default Payload Items
|
||||
* --------------------------------------------------------------------
|
||||
* All JWTs will have these claims in the payload.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $defaultClaims = [
|
||||
'iss' => 'https://safekat.com',
|
||||
];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------
|
||||
* The Keys
|
||||
* --------------------------------------------------------------------
|
||||
* The key of the array is the key group name.
|
||||
* The first key of the group is used for signing.
|
||||
*
|
||||
* @var array<string, array<int, array<string, string>>>
|
||||
* @phpstan-var array<string, list<array<string, string>>>
|
||||
*/
|
||||
public array $keys = [
|
||||
'default' => [
|
||||
// Symmetric Key
|
||||
[
|
||||
'kid' => '', // Key ID. Optional if you have only one key.
|
||||
'alg' => 'HS256', // algorithm.
|
||||
// Set secret random string. Needs at least 256 bits for HS256 algorithm.
|
||||
// E.g., $ php -r 'echo base64_encode(random_bytes(32));'
|
||||
'secret' => 'ZAfosrIVWDaKEhBhicTKCpW8T5ZxC3GYAxFgCkUQjlU=',
|
||||
],
|
||||
// Asymmetric Key
|
||||
// [
|
||||
// 'kid' => '', // Key ID. Optional if you have only one key.
|
||||
// 'alg' => 'RS256', // algorithm.
|
||||
// 'public' => '', // Public Key
|
||||
// 'private' => '', // Private Key
|
||||
// 'passphrase' => '' // Passphrase
|
||||
// ],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------
|
||||
* Time To Live (in seconds)
|
||||
* --------------------------------------------------------------------
|
||||
* Specifies the amount of time, in seconds, that a token is valid.
|
||||
*/
|
||||
public int $timeToLive = HOUR;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------
|
||||
* Record Login Attempts
|
||||
* --------------------------------------------------------------------
|
||||
* Whether login attempts are recorded in the database.
|
||||
*
|
||||
* Valid values are:
|
||||
* - Auth::RECORD_LOGIN_ATTEMPT_NONE
|
||||
* - Auth::RECORD_LOGIN_ATTEMPT_FAILURE
|
||||
* - Auth::RECORD_LOGIN_ATTEMPT_ALL
|
||||
*/
|
||||
public int $recordLoginAttempt = Auth::RECORD_LOGIN_ATTEMPT_FAILURE;
|
||||
}
|
||||
0
ci4/app/Config/AuthToken.php
Normal file → Executable file
0
ci4/app/Config/AuthToken.php
Normal file → Executable file
@ -46,6 +46,7 @@ class Autoload extends AutoloadConfig
|
||||
public $psr4 = [
|
||||
APP_NAMESPACE => APPPATH, // For custom app namespace
|
||||
'Config' => APPPATH . 'Config',
|
||||
'Libraries' => APPPATH . 'Libraries',
|
||||
'Dompdf' => APPPATH . 'ThirdParty/dompdf/src',
|
||||
];
|
||||
|
||||
|
||||
0
ci4/app/Config/CURLRequest.php
Normal file → Executable file
0
ci4/app/Config/CURLRequest.php
Normal file → Executable file
@ -71,6 +71,32 @@ class Database extends Config
|
||||
'busyTimeout' => 1000,
|
||||
];
|
||||
|
||||
public array $old_erp = [
|
||||
'DSN' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'database' => '',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => '',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => true,
|
||||
'charset' => 'utf8mb4',
|
||||
'DBCollat' => 'utf8mb4_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
'numberNative' => false,
|
||||
'dateFormat' => [
|
||||
'date' => 'Y-m-d',
|
||||
'datetime' => 'Y-m-d H:i:s',
|
||||
'time' => 'H:i:s',
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@ -6,14 +6,14 @@ use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Email extends BaseConfig
|
||||
{
|
||||
public string $fromEmail = 'safekat@imnavajas.es';
|
||||
public string $fromName = 'Safekat ERP';
|
||||
public string $fromEmail = 'no-reply@safekat.es';
|
||||
public string $fromName = 'ERP Safekat 2.0';
|
||||
public string $recipients = '';
|
||||
|
||||
/**
|
||||
* The "user agent"
|
||||
*/
|
||||
public string $userAgent = 'Safekat SL';
|
||||
public string $userAgent = 'ERP Safekat 2.0';
|
||||
|
||||
/**
|
||||
* The mail sending protocol: mail, sendmail, smtp
|
||||
@ -28,27 +28,27 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* SMTP Server Hostname
|
||||
*/
|
||||
public string $SMTPHost = 'imnavajas.es';
|
||||
public string $SMTPHost = 'smtp.ionos.es';
|
||||
|
||||
/**
|
||||
* SMTP Username
|
||||
*/
|
||||
public string $SMTPUser = 'safekat@imnavajas.es';
|
||||
public string $SMTPUser = 'no-reply@safekat.es';
|
||||
|
||||
/**
|
||||
* SMTP Password
|
||||
*/
|
||||
public string $SMTPPass = 'Etkd9~448';
|
||||
public string $SMTPPass = '5LKHH^CR#ecR#l55x7ke';
|
||||
|
||||
/**
|
||||
* SMTP Port
|
||||
*/
|
||||
public int $SMTPPort = 25;
|
||||
public int $SMTPPort = 587;
|
||||
|
||||
/**
|
||||
* SMTP Timeout (in seconds)
|
||||
*/
|
||||
public int $SMTPTimeout = 5;
|
||||
public int $SMTPTimeout = 15;
|
||||
|
||||
/**
|
||||
* Enable persistent SMTP connections
|
||||
|
||||
0
ci4/app/Config/Feature.php
Normal file → Executable file
0
ci4/app/Config/Feature.php
Normal file → Executable file
@ -8,6 +8,7 @@ use CodeIgniter\Filters\DebugToolbar;
|
||||
use CodeIgniter\Filters\Honeypot;
|
||||
use CodeIgniter\Filters\InvalidChars;
|
||||
use CodeIgniter\Filters\SecureHeaders;
|
||||
use CodeIgniter\Shield\Authentication\Authenticators\JWT;
|
||||
|
||||
|
||||
class Filters extends BaseConfig
|
||||
@ -25,6 +26,7 @@ class Filters extends BaseConfig
|
||||
'honeypot' => Honeypot::class,
|
||||
'invalidchars' => InvalidChars::class,
|
||||
'secureheaders' => SecureHeaders::class,
|
||||
'cors' => \App\Filters\Cors::class
|
||||
];
|
||||
|
||||
/**
|
||||
@ -43,6 +45,8 @@ class Filters extends BaseConfig
|
||||
'login*',
|
||||
'register',
|
||||
'auth/a/*',
|
||||
'auth/jwt',
|
||||
'api/*',
|
||||
'logout']
|
||||
],
|
||||
],
|
||||
@ -73,5 +77,10 @@ class Filters extends BaseConfig
|
||||
* Example:
|
||||
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
||||
*/
|
||||
public array $filters = [];
|
||||
public array $filters = [
|
||||
/*'jwt' => [
|
||||
'before' => ['api', 'api/*']
|
||||
],*/
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
0
ci4/app/Config/Kint.php
Normal file → Executable file
0
ci4/app/Config/Kint.php
Normal file → Executable file
31
ci4/app/Config/LogoImpresion.php
Executable file
31
ci4/app/Config/LogoImpresion.php
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class LogoImpresion extends BaseConfig
|
||||
{
|
||||
|
||||
public array $TIPO_IMPRESION_MAPPING = [
|
||||
"lp_bn" => "icon_bn",
|
||||
"lp_bnhq" => "icon_bnhq",
|
||||
"lp_color" => "icon_color",
|
||||
"lp_colorhq" => "icon_colorhq",
|
||||
"lp_cubierta" => "icon_cubierta",
|
||||
"lp_sobrecubierta" => "icon_sobrecubierta",
|
||||
"lp_rot_bn" => "icon_rotativa_bn",
|
||||
"lp_rot_color" => "icon_rotativa_color",
|
||||
"lp_guardas" => "icon_cuardas"
|
||||
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function get_logo_path(string $tipo): string
|
||||
{
|
||||
return "themes/vuexy/img/safekat/presupuestos/" . $this->TIPO_IMPRESION_MAPPING[$tipo] . ".png";
|
||||
}
|
||||
}
|
||||
138
ci4/app/Config/OrdenTrabajo.php
Executable file
138
ci4/app/Config/OrdenTrabajo.php
Executable file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class OrdenTrabajo extends BaseConfig
|
||||
{
|
||||
|
||||
public array $DATE_USER_MAPPING = [
|
||||
//IMPRESION
|
||||
"interior_bn_at" => "interior_bn_user_id",
|
||||
"interior_color_at" => "interior_color_user_id",
|
||||
"cubierta_at" => "cubierta_user_id",
|
||||
"sobrecubierta_at" => "sobrecubierta_user_id",
|
||||
"guarda_at" => "guarda_user_id",
|
||||
//ACABADO
|
||||
"plastificado_at" => "plastificado_user_id",
|
||||
"plakene_at" => "plakene_user_id",
|
||||
"retractilado_at" => "retractilado_user_id",
|
||||
"estampado_at" => "estampado_user_id",
|
||||
"uvi_at" => "uvi_user_id",
|
||||
"encuadernacion_at" => "encuadernacion_user_id",
|
||||
"corte_at" => "corte_user_id",
|
||||
"preparacion_interiores_at" => "preparacion_interior_user_id",
|
||||
"entrada_manipulado_at" => "entrada_manipulado_user_id",
|
||||
"cosido_at" => "cosido_user_id",
|
||||
"grapado_at" => "grapado_user_id",
|
||||
"solapa_at" => "solapa_user_id",
|
||||
"retractilado5_at" => "retractilado5_user_id",
|
||||
"prototipo_at" => "prototipo_user_id",
|
||||
"marcapaginas_at" => "marcapaginas_user_id",
|
||||
"espiral_at" => "espiral_user_id",
|
||||
//FERRO
|
||||
"pendiente_ferro_at" => "pendiente_ferro_user_id",
|
||||
"ferro_en_cliente_at" => "ferro_en_cliente_user_id",
|
||||
"ferro_ok_at" => "ferro_ok_user_id",
|
||||
//ENVIO
|
||||
"embalaje_at" => "embalaje_user_id",
|
||||
"envio_at" => "envio_user_id",
|
||||
//PREIMPRESION
|
||||
"pre_formato_at" => "pre_formato_user_id",
|
||||
"pre_lomo_at" => "pre_lomo_user_id",
|
||||
"pre_solapa_at" => "pre_solapa_user_id",
|
||||
"pre_codbarras_at" => "pre_codbarras_user_id",
|
||||
"pre_imposicion_at" => "pre_imposicion_user_id",
|
||||
|
||||
];
|
||||
public array $DATE_USER_MAPPING_PEDIDO = [
|
||||
"inaplazable" => "inaplazable_change_user_id",
|
||||
"fecha_entrega_real" => "fecha_entrega_real_change_user_id",
|
||||
"fecha_impresion" => "fecha_impresion_change_user_id",
|
||||
"fecha_encuadernado" => "fecha_encuadernado_change_user_id",
|
||||
"fecha_entrega_externo" => "fecha_entrega_externo_change_user_id",
|
||||
];
|
||||
public array $OT_COLORS = [
|
||||
"sin_imprimir" => "#FF6363",
|
||||
"impreso_int" => "#AFDDFF",
|
||||
"impreso_cub" => "#3A59D1",
|
||||
"plastificado" => "#FFD63A",
|
||||
"preparado" => "#FF0B55",
|
||||
"solapa" => "#4F1C51",
|
||||
"cosido" => "#FF0B55",
|
||||
"grapado" => "#FEBA17",
|
||||
"encuadernado" => "#FEBA17",
|
||||
"corte" => "#67AE6E"
|
||||
];
|
||||
public array $OT_WEEK_COLOR_DAY = [
|
||||
["bg" => "#FFFFFF", "color" => "black"],
|
||||
["bg" => "yellow", "color" => "black"],
|
||||
["bg" => "purple", "color" => "white"],
|
||||
["bg" => "orange", "color" => "white"],
|
||||
["bg" => "blue", "color" => "white"],
|
||||
["bg" => "pink", "color" => "black"],
|
||||
["bg" => "#FFFFFF", "color" => "black"],
|
||||
];
|
||||
public array $OT_ENCUADERNACION_COLOR = [
|
||||
"RF" => ["bg" => "#FF9900", "color" => "white"],
|
||||
"RFS" => ["bg" => "#FF9900", "color" => "white"],
|
||||
"RCHV" => ["bg" => "#FF9900", "color" => "blue"],
|
||||
"RCHVS" => ["bg" => "#FF9900", "color" => "blue"],
|
||||
"CC2" => ["bg" => "#104861", "color" => "yellow"],
|
||||
"CC2S" => ["bg" => "#104861", "color" => "yellow"],
|
||||
"TDF" => ["bg" => "#E49EDD", "color" => "white"],
|
||||
"TDC" => ["bg" => "#E49EDD", "color" => "blue"],
|
||||
"default" => ["bg" => "#FFFF00", "color" => "red"],
|
||||
];
|
||||
public array $OT_BACKGROUND_COLOR = [
|
||||
"ferro_digital" => ["bg" => "#BFBFBF","color" => "black"],
|
||||
"ferro" => ["bg" => "#BFBFBF","color" => "black"],
|
||||
"prototipo" => ["bg" => "#BFBFBF","color" => "black"],
|
||||
"pod" => ["bg" => "#47D359","color" => "black"],
|
||||
"inaplazable" => ["bg" => "red","color" => "white"],
|
||||
"default" => ["bg" => "#FFFFFF","color" => "black"]
|
||||
];
|
||||
public array $OT_PAPEL_COLOR =
|
||||
[
|
||||
"blanco" => ["bg" => "#FFFFFF", "color" => "black"],
|
||||
"ahuesado" => ["bg" => "#FFF2CC", "color" => "black"],
|
||||
"marfil" => ["bg" => "#FFD966", "color" => "black"],
|
||||
"volumen_ahuesado" => ["bg" => "#BF8F00", "color" => "black"],
|
||||
"estucado_mate" => ["bg" => "#BDD7EE", "color" => "black"],
|
||||
"cartulina" => ["bg" => "#C6E0B4", "color" => "black"],
|
||||
"default" => ["bg" => "#FFCCFF", "color" => "black"],
|
||||
];
|
||||
public array $OT_PLASTIFICADO_COLOR =
|
||||
[
|
||||
"BRILLO" => ["bg" => "#00B0F0", "color" => "white"],
|
||||
"MATE" => ["bg" => "#FF0000", "color" => "white"],
|
||||
"SOFT" => ["bg" => "#00B050", "color" => "white"],
|
||||
"SANDY" => ["bg" => "#782170", "color" => "white"],
|
||||
"ANTIRAYADO" => ["bg" => "#E97132", "color" => "white"],
|
||||
"GOFRADO" => ["bg" => "#FFFF00", "color" => "black"],
|
||||
"default" => ["bg" => "#FFFFFF", "color" => "black"],
|
||||
];
|
||||
public array $OT_IMPRESION_INTERIOR_PPAL_COLOR =
|
||||
[
|
||||
"ROTATIVA" => ["bg" => "white", "color" => "red"],
|
||||
"POD" => ["bg" => "white", "color" => "#47D359"],
|
||||
"GENERAL" => ["bg" => "white", "color" => "#A02B93"],
|
||||
"default" => ["bg" => "white", "color" => "black"],
|
||||
];
|
||||
|
||||
public array $OT_TAREA_STATUS_COLOR = [
|
||||
"P" => '#FFB22C',
|
||||
"F" => '#67AE6E',
|
||||
"S" => '#EB5B00',
|
||||
"I" => '#3A59D1',
|
||||
"E" => '#FF0B55',
|
||||
"D" => '#FFA725',
|
||||
];
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
29
ci4/app/Config/PedidoXML.php
Executable file
29
ci4/app/Config/PedidoXML.php
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class PedidoXML extends BaseConfig
|
||||
{
|
||||
|
||||
public string $host;
|
||||
public int $port;
|
||||
public string $username;
|
||||
public string $password;
|
||||
public string $base_dir; # FTP server directory
|
||||
public bool $xml_enabled;
|
||||
public int $id_offset;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->host = env("HIDRIVE_HOST","10.5.0.6");
|
||||
$this->port = env("HIDRIVE_PORT",21);
|
||||
$this->username = env("HIDRIVE_USER","admin");
|
||||
$this->password = env("HIDRIVE_PASS","A77h3b0X4OA2rOYAf4w2");
|
||||
$this->base_dir = env("HIDRIVE_PATH_ROOT","/home/admin/safekat"); # FTP server directory
|
||||
$this->xml_enabled = env("FTP_XML_ENABLED",false);
|
||||
$this->id_offset = env("XML_OFFSET_CUSTOMER_ID",1000000);
|
||||
|
||||
}
|
||||
}
|
||||
0
ci4/app/Config/Publisher.php
Normal file → Executable file
0
ci4/app/Config/Publisher.php
Normal file → Executable file
0
ci4/app/Config/RBAC/.gitkeep
Executable file
0
ci4/app/Config/RBAC/.gitkeep
Executable file
@ -1,209 +0,0 @@
|
||||
<?php
|
||||
const SK_PERMISSION_MATRIX = [
|
||||
"admin" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.delete",
|
||||
"clientes.menu",
|
||||
"plantilla-tarifa.create",
|
||||
"plantilla-tarifa.edit",
|
||||
"plantilla-tarifa.delete",
|
||||
"plantilla-tarifa.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.delete",
|
||||
"presupuesto.menu",
|
||||
"tarifa-preimpresion.create",
|
||||
"tarifa-preimpresion.edit",
|
||||
"tarifa-preimpresion.delete",
|
||||
"tarifa-preimpresion.menu",
|
||||
"tarifa-manipulado.create",
|
||||
"tarifa-manipulado.edit",
|
||||
"tarifa-manipulado.delete",
|
||||
"tarifa-manipulado.menu",
|
||||
"tarifa-acabado.create",
|
||||
"tarifa-acabado.edit",
|
||||
"tarifa-acabado.delete",
|
||||
"tarifa-acabado.menu",
|
||||
"tarifa-encuadernacion.create",
|
||||
"tarifa-encuadernacion.edit",
|
||||
"tarifa-encuadernacion.delete",
|
||||
"tarifa-encuadernacion.menu",
|
||||
"tarifa-envio.create",
|
||||
"tarifa-envio.edit",
|
||||
"tarifa-envio.delete",
|
||||
"tarifa-envio.menu",
|
||||
"proveedores.create",
|
||||
"proveedores.edit",
|
||||
"proveedores.delete",
|
||||
"proveedores.menu",
|
||||
"ajustes.create",
|
||||
"ajustes.edit",
|
||||
"ajustes.delete",
|
||||
"ajustes.menu",
|
||||
"actividad.create",
|
||||
"actividad.edit",
|
||||
"actividad.delete",
|
||||
"actividad.menu",
|
||||
"paises.create",
|
||||
"paises.edit",
|
||||
"paises.delete",
|
||||
"paises.menu",
|
||||
"maquinas.create",
|
||||
"maquinas.edit",
|
||||
"maquinas.delete",
|
||||
"maquinas.menu",
|
||||
"maquinas-defecto.create",
|
||||
"maquinas-defecto.edit",
|
||||
"maquinas-defecto.delete",
|
||||
"maquinas-defecto.menu",
|
||||
"papel-generico.create",
|
||||
"papel-generico.edit",
|
||||
"papel-generico.delete",
|
||||
"papel-generico.menu",
|
||||
"papel-impresion.create",
|
||||
"papel-impresion.edit",
|
||||
"papel-impresion.delete",
|
||||
"papel-impresion.menu",
|
||||
"usuarios.create",
|
||||
"usuarios.edit",
|
||||
"usuarios.delete",
|
||||
"usuarios.menu",
|
||||
"roles-permisos.create",
|
||||
"roles-permisos.edit",
|
||||
"roles-permisos.delete",
|
||||
"roles-permisos.menu",
|
||||
],
|
||||
"cliente-admin" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.delete",
|
||||
"clientes.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.delete",
|
||||
"presupuesto.menu",
|
||||
],
|
||||
"cliente-editor" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.delete",
|
||||
"clientes.menu",
|
||||
"plantilla-tarifa.create",
|
||||
"plantilla-tarifa.edit",
|
||||
"plantilla-tarifa.delete",
|
||||
"plantilla-tarifa.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.delete",
|
||||
"presupuesto.menu",
|
||||
"tarifa-preimpresion.create",
|
||||
"tarifa-preimpresion.edit",
|
||||
"tarifa-preimpresion.delete",
|
||||
"tarifa-preimpresion.menu",
|
||||
"tarifa-manipulado.create",
|
||||
"tarifa-manipulado.edit",
|
||||
"tarifa-manipulado.delete",
|
||||
"tarifa-manipulado.menu",
|
||||
"tarifa-acabado.create",
|
||||
"tarifa-acabado.edit",
|
||||
"tarifa-acabado.delete",
|
||||
"tarifa-acabado.menu",
|
||||
"tarifa-encuadernacion.create",
|
||||
"tarifa-encuadernacion.edit",
|
||||
"tarifa-encuadernacion.delete",
|
||||
"tarifa-encuadernacion.menu",
|
||||
"tarifa-envio.create",
|
||||
"tarifa-envio.edit",
|
||||
"tarifa-envio.delete",
|
||||
"tarifa-envio.menu",
|
||||
"proveedores.create",
|
||||
"proveedores.edit",
|
||||
"proveedores.delete",
|
||||
"proveedores.menu",
|
||||
"ajustes.create",
|
||||
"ajustes.edit",
|
||||
"ajustes.delete",
|
||||
"ajustes.menu",
|
||||
"actividad.create",
|
||||
"actividad.edit",
|
||||
"actividad.delete",
|
||||
"actividad.menu",
|
||||
],
|
||||
"comercial" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"produccion" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"maquina" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"maquetador" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"director" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"contabilidad" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"editor" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
"Profile.index",
|
||||
"Profile.menu",
|
||||
],
|
||||
"beta" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.delete",
|
||||
"clientes.menu",
|
||||
"plantilla-tarifa.create",
|
||||
"plantilla-tarifa.edit",
|
||||
"plantilla-tarifa.delete",
|
||||
"plantilla-tarifa.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.delete",
|
||||
"presupuesto.menu",
|
||||
"tarifa-preimpresion.create",
|
||||
"tarifa-preimpresion.edit",
|
||||
"tarifa-preimpresion.delete",
|
||||
"tarifa-preimpresion.menu",
|
||||
"tarifa-manipulado.create",
|
||||
"tarifa-manipulado.edit",
|
||||
"tarifa-manipulado.delete",
|
||||
"tarifa-manipulado.menu",
|
||||
"tarifa-acabado.create",
|
||||
"tarifa-acabado.edit",
|
||||
"tarifa-acabado.delete",
|
||||
"tarifa-acabado.menu",
|
||||
"tarifa-encuadernacion.create",
|
||||
"tarifa-encuadernacion.edit",
|
||||
"tarifa-encuadernacion.delete",
|
||||
"tarifa-encuadernacion.menu",
|
||||
"tarifa-envio.create",
|
||||
"tarifa-envio.edit",
|
||||
"tarifa-envio.delete",
|
||||
"tarifa-envio.menu",
|
||||
"proveedores.create",
|
||||
"proveedores.edit",
|
||||
"proveedores.delete",
|
||||
"proveedores.menu",
|
||||
"ajustes.create",
|
||||
"ajustes.edit",
|
||||
"ajustes.delete",
|
||||
"ajustes.menu",
|
||||
"actividad.create",
|
||||
"actividad.edit",
|
||||
"actividad.delete",
|
||||
"actividad.menu",
|
||||
],
|
||||
];
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
const SK_PERMISSION_MATRIX = [
|
||||
"superadmin"=> [
|
||||
"admin.*",
|
||||
"users.*",
|
||||
"beta.*"
|
||||
],
|
||||
"admin"=> [
|
||||
"admin.access",
|
||||
"users.create",
|
||||
"users.edit",
|
||||
"users.delete",
|
||||
"beta.access"
|
||||
],
|
||||
"developer"=> [
|
||||
"admin.access",
|
||||
"admin.settings",
|
||||
"users.create",
|
||||
"users.edit",
|
||||
"beta.access"
|
||||
],
|
||||
"user"=> [
|
||||
"users.list"
|
||||
],
|
||||
"beta"=> [
|
||||
"beta.access"
|
||||
]
|
||||
];
|
||||
@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
const SK_PERMISSIONS = [
|
||||
'clientes.create' => 'Can create',
|
||||
'clientes.edit' => 'Can edit',
|
||||
'clientes.delete' => 'Can delete',
|
||||
'clientes.menu' => 'Menu shall be visualize',
|
||||
'plantilla-tarifa.create' => 'Can create',
|
||||
'plantilla-tarifa.edit' => 'Can edit',
|
||||
'plantilla-tarifa.delete' => 'Can delete',
|
||||
'plantilla-tarifa.menu' => 'Menu shall be visualize',
|
||||
'presupuesto.create' => 'Can create',
|
||||
'presupuesto.edit' => 'Can edit',
|
||||
'presupuesto.delete' => 'Can delete',
|
||||
'presupuesto.menu' => 'Menu shall be visualize',
|
||||
'tarifa-preimpresion.create' => 'Can create',
|
||||
'tarifa-preimpresion.edit' => 'Can edit',
|
||||
'tarifa-preimpresion.delete' => 'Can delete',
|
||||
'tarifa-preimpresion.menu' => 'Menu shall be visualize',
|
||||
'tarifa-manipulado.create' => 'Can create',
|
||||
'tarifa-manipulado.edit' => 'Can edit',
|
||||
'tarifa-manipulado.delete' => 'Can delete',
|
||||
'tarifa-manipulado.menu' => 'Menu shall be visualize',
|
||||
'tarifa-acabado.create' => 'Can create',
|
||||
'tarifa-acabado.edit' => 'Can edit',
|
||||
'tarifa-acabado.delete' => 'Can delete',
|
||||
'tarifa-acabado.menu' => 'Menu shall be visualize',
|
||||
'tarifa-encuadernacion.create' => 'Can create',
|
||||
'tarifa-encuadernacion.edit' => 'Can edit',
|
||||
'tarifa-encuadernacion.delete' => 'Can delete',
|
||||
'tarifa-encuadernacion.menu' => 'Menu shall be visualize',
|
||||
'tarifa-envio.create' => 'Can create',
|
||||
'tarifa-envio.edit' => 'Can edit',
|
||||
'tarifa-envio.delete' => 'Can delete',
|
||||
'tarifa-envio.menu' => 'Menu shall be visualize',
|
||||
'proveedores.create' => 'Can create',
|
||||
'proveedores.edit' => 'Can edit',
|
||||
'proveedores.delete' => 'Can delete',
|
||||
'proveedores.menu' => 'Menu shall be visualize',
|
||||
'ajustes.create' => 'Can create',
|
||||
'ajustes.edit' => 'Can edit',
|
||||
'ajustes.delete' => 'Can delete',
|
||||
'ajustes.menu' => 'Menu shall be visualize',
|
||||
'actividad.create' => 'Can create',
|
||||
'actividad.edit' => 'Can edit',
|
||||
'actividad.delete' => 'Can delete',
|
||||
'actividad.menu' => 'Menu shall be visualize',
|
||||
'paises.create' => 'Can create',
|
||||
'paises.edit' => 'Can edit',
|
||||
'paises.delete' => 'Can delete',
|
||||
'paises.menu' => 'Menu shall be visualize',
|
||||
'maquinas.create' => 'Can create',
|
||||
'maquinas.edit' => 'Can edit',
|
||||
'maquinas.delete' => 'Can delete',
|
||||
'maquinas.menu' => 'Menu shall be visualize',
|
||||
'maquinas-defecto.create' => 'Can create',
|
||||
'maquinas-defecto.edit' => 'Can edit',
|
||||
'maquinas-defecto.delete' => 'Can delete',
|
||||
'maquinas-defecto.menu' => 'Menu shall be visualize',
|
||||
'papel-generico.create' => 'Can create',
|
||||
'papel-generico.edit' => 'Can edit',
|
||||
'papel-generico.delete' => 'Can delete',
|
||||
'papel-generico.menu' => 'Menu shall be visualize',
|
||||
'papel-impresion.create' => 'Can create',
|
||||
'papel-impresion.edit' => 'Can edit',
|
||||
'papel-impresion.delete' => 'Can delete',
|
||||
'papel-impresion.menu' => 'Menu shall be visualize',
|
||||
'usuarios.create' => 'Can create',
|
||||
'usuarios.edit' => 'Can edit',
|
||||
'usuarios.delete' => 'Can delete',
|
||||
'usuarios.menu' => 'Menu shall be visualize',
|
||||
'roles-permisos.create' => 'Can create',
|
||||
'roles-permisos.edit' => 'Can edit',
|
||||
'roles-permisos.delete' => 'Can delete',
|
||||
'roles-permisos.menu' => 'Menu shall be visualize',
|
||||
];
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
const SK_PERMISSIONS = [
|
||||
'admin.access' => 'Can access the sites admin area',
|
||||
'admin.settings' => 'Can access the main site settings',
|
||||
'users.manage-admins' => 'Can manage other admins',
|
||||
'users.list' => 'Can list user stuff',
|
||||
'users.create' => 'Can create new non-admin users',
|
||||
'users.edit' => 'Can edit existing non-admin users',
|
||||
'users.delete' => 'Can delete existing non-admin users',
|
||||
'beta.access' => 'Can access beta-level features',
|
||||
];
|
||||
@ -1,22 +0,0 @@
|
||||
{
|
||||
"superadmin": {
|
||||
"title": "Super Admin",
|
||||
"description": "Complete control of the site."
|
||||
},
|
||||
"admin": {
|
||||
"title": "Admin",
|
||||
"description": "Day to day administrators of the site."
|
||||
},
|
||||
"developer": {
|
||||
"title": "Developer",
|
||||
"description": "Site programmers."
|
||||
},
|
||||
"user": {
|
||||
"title": "User",
|
||||
"description": "General users of the site. Often customers."
|
||||
},
|
||||
"beta": {
|
||||
"title": "Beta User",
|
||||
"description": "Has access to beta-level features."
|
||||
}
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
const SK_ROLES = [
|
||||
'admin' => [
|
||||
'title' => 'Administrador',
|
||||
'description' => '',
|
||||
],
|
||||
'cliente-admin' => [
|
||||
'title' => 'Cliente administrador',
|
||||
'description' => 'Rol de cliente con permisos de administración',
|
||||
],
|
||||
'cliente-editor' => [
|
||||
'title' => 'Cliente editor',
|
||||
'description' => 'Rol de cliente con permisos de edición',
|
||||
],
|
||||
'comercial' => [
|
||||
'title' => 'Comercial',
|
||||
'description' => '',
|
||||
],
|
||||
'produccion' => [
|
||||
'title' => 'Producción',
|
||||
'description' => '',
|
||||
],
|
||||
'maquina' => [
|
||||
'title' => 'Máquina',
|
||||
'description' => '',
|
||||
],
|
||||
'maquetador' => [
|
||||
'title' => 'Maquetador',
|
||||
'description' => '',
|
||||
],
|
||||
'director' => [
|
||||
'title' => 'Director',
|
||||
'description' => '',
|
||||
],
|
||||
'contabilidad' => [
|
||||
'title' => 'Contabilidad',
|
||||
'description' => '',
|
||||
],
|
||||
'editor' => [
|
||||
'title' => 'Editor',
|
||||
'description' => '',
|
||||
],
|
||||
'beta' => [
|
||||
'title' => 'Beta',
|
||||
'description' => '',
|
||||
],
|
||||
];
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
const SK_ROLES = [
|
||||
'superadmin' => [
|
||||
'title' => 'Super Admin',
|
||||
'description' => 'Complete control of the site.',
|
||||
],
|
||||
'admin' => [
|
||||
'title' => 'Admin',
|
||||
'description' => 'Day to day administrators of the site.',
|
||||
],
|
||||
'developer' => [
|
||||
'title' => 'Developer',
|
||||
'description' => 'Site programmers.',
|
||||
],
|
||||
'user' => [
|
||||
'title' => 'User',
|
||||
'description' => 'General users of the site. Often customers.',
|
||||
],
|
||||
'beta' => [
|
||||
'title' => 'Beta User',
|
||||
'description' => 'Has access to beta-level features.',
|
||||
],
|
||||
];
|
||||
@ -9,23 +9,22 @@ use CodeIgniter\Router\RouteCollection;
|
||||
//service('auth')->routes($routes, ['except' => ['login', 'register']]);
|
||||
service('auth')->routes($routes);
|
||||
|
||||
|
||||
//WEB ROUTER ------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
$routes->get('/', 'Home::index', ['as' => 'home']);
|
||||
$routes->get('lang/{locale}', 'Language::index');
|
||||
$routes->get('viewmode/(:alpha)', 'Viewmode::index/$1');
|
||||
|
||||
/* URL FOR TESTS */
|
||||
$routes->get('test', 'Test::index');
|
||||
|
||||
|
||||
$routes->group('activity', ['namespace' => 'App\Controllers\Sistema'], function ($routes) {
|
||||
$routes->get('', 'Actividad::index', ['as' => 'activityList']);
|
||||
$routes->post('datatable', 'Actividad::datatable', ['as' => 'activityDT']);
|
||||
});
|
||||
|
||||
$routes->group('settings', ['namespace' => 'App\Controllers\Sistema'], function ($routes) {
|
||||
$routes->get('', 'Ajustes::settings', ['as' => 'ajustesList']);
|
||||
$routes->post('', 'Ajustes::settings', ['as' => 'ajustesEdit']);
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
@ -33,31 +32,16 @@ $routes->group('settings', ['namespace' => 'App\Controllers\Sistema'], function
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Rutas para configuraciones */
|
||||
$routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
|
||||
/* Cliente */
|
||||
$routes->group('acabados', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
|
||||
$routes->get('', 'TarifaAcabados::index', ['as' => 'tarifaAcabadoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'TarifaAcabados::add', ['as' => 'tarifaAcabadoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
|
||||
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
|
||||
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);
|
||||
|
||||
$routes->group('lineas', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
$routes->post('datatable', 'TarifaAcabadosLineas::datatable', ['as' => 'tarifaAcabadoLineasDT']);
|
||||
$routes->post('datatable_editor', 'TarifaAcabadosLineas::datatable_editor', ['as' => 'tarifaAcabadoLineasDTE']);
|
||||
$routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
// Carga archivos de rutas por dominio
|
||||
foreach (glob(APPPATH . 'Config/Routes/*Routes.php') as $routeFile) {
|
||||
require $routeFile;
|
||||
}
|
||||
|
||||
|
||||
$routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Users::index', ['as' => 'userList']);
|
||||
$routes->get('index', 'Users::index', ['as' => 'userIndex']);
|
||||
$routes->get('maquinista/change/user', 'Users::index_maquinista_change_user', ['as' => 'maquinistaUserChangeList']);
|
||||
$routes->get('maquinista/change/session/(:num)', 'Users::change_user_session/$1', ['as' => 'maquinistaChangeUserSession']);
|
||||
$routes->get('list', 'Users::index', ['as' => 'userList2']);
|
||||
$routes->get('add', 'Users::add', ['as' => 'newUser']);
|
||||
$routes->post('add', 'Users::add', ['as' => 'createUser']);
|
||||
@ -66,17 +50,12 @@ $routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], functi
|
||||
$routes->get('delete/(:num)', 'Users::delete/$1', ['as' => 'deleteUser']);
|
||||
$routes->post('allmenuitems', 'Users::allItemsSelect', ['as' => 'select2ItemsOfUsers']);
|
||||
$routes->post('menuitems', 'Users::menuItems', ['as' => 'menuItemsOfUsers']);
|
||||
$routes->post('datatable', 'Users::datatable', ['as' => 'datatableOfUsers']);
|
||||
$routes->get('getMenuComerciales', 'Users::getMenuComerciales', ['as' => 'menuItemsComerciales']);
|
||||
});
|
||||
|
||||
$routes->group('group', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Group::index', ['as' => 'userGroupList']);
|
||||
$routes->get('index', 'Group::index', ['as' => 'groupIndex']);
|
||||
$routes->post('edit/(:num)', 'Group::edit/$1', ['as' => 'updateGroup']);
|
||||
$routes->get('edit/(:num)', 'Group::edit/$1', ['as' => 'editGroup']);
|
||||
$routes->get('delete/(:num)', 'Group::delete/$1', ['as' => 'deleteGroup']);
|
||||
$routes->get('add', 'Group::add', ['as' => 'newGroup']);
|
||||
$routes->post('add', 'Group::add', ['as' => 'createGroup']);
|
||||
});
|
||||
$routes->resource('users', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Users', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('tarifapreimpresion', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
$routes->get('', 'Tarifapreimpresion::index', ['as' => 'tarifapreimpresionList']);
|
||||
@ -89,6 +68,7 @@ $routes->group('tarifapreimpresion', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->get('delete/(:num)', 'Tarifapreimpresion::delete/$1', ['as' => 'deleteTarifapreimpresion']);
|
||||
$routes->post('allmenuitems', 'Tarifapreimpresion::allItemsSelect', ['as' => 'select2ItemsOfTarifaspreimpresion']);
|
||||
$routes->post('menuitems', 'Tarifapreimpresion::menuItems', ['as' => 'menuItemsOfTarifaspreimpresion']);
|
||||
$routes->get('gettarifas', 'Tarifapreimpresion::getSelect2');
|
||||
});
|
||||
|
||||
|
||||
@ -103,6 +83,7 @@ $routes->group('tarifaextra', ['namespace' => 'App\Controllers\Tarifas'], functi
|
||||
$routes->get('delete/(:num)', 'Tarifaextra::delete/$1', ['as' => 'deleteTarifaextra']);
|
||||
$routes->post('allmenuitems', 'Tarifaextra::allItemsSelect', ['as' => 'select2ItemsOfTarifasextra']);
|
||||
$routes->post('menuitems', 'Tarifaextra::menuItems', ['as' => 'menuItemsOfTarifasextra']);
|
||||
$routes->get('gettarifas', 'Tarifaextra::getSelect2');
|
||||
});
|
||||
|
||||
|
||||
@ -117,10 +98,25 @@ $routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->post('datatable', 'Tarifasmanipulado::datatable', ['as' => 'dataTableOfTarifasManipulado']);
|
||||
$routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']);
|
||||
$routes->post('menuitems', 'Tarifasmanipulado::menuItems', ['as' => 'menuItemsOfTarifasManipulado']);
|
||||
$routes->get('select', 'Tarifasmanipulado::show_select', ["as" => "showSelectTarifaManipulado"]);
|
||||
$routes->get('gettarifas', 'Tarifasmanipulado::getSelect2');
|
||||
});
|
||||
$routes->resource('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('serviciosacabado', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
$routes->get('', 'ServiciosAcabado::index', ['as' => 'serviciosAcabadoList']);
|
||||
$routes->get('add', 'ServiciosAcabado::add', ['as' => 'newServicioAcabado']);
|
||||
$routes->post('add', 'ServiciosAcabado::add', ['as' => 'createServicioAcabado']);
|
||||
$routes->get('edit/(:num)', 'ServiciosAcabado::edit/$1', ['as' => 'editServicioAcabado']);
|
||||
$routes->post('edit/(:num)', 'ServiciosAcabado::edit/$1', ['as' => 'updateServicioAcabado']);
|
||||
$routes->get('datatable', 'ServiciosAcabado::datatable');
|
||||
$routes->get('getselectedtarifas', 'ServiciosAcabado::getTarifasSeleccionadas');
|
||||
$routes->get('gettarifas', 'ServiciosAcabado::getTarifas');
|
||||
});
|
||||
$routes->resource('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas\Acabados', 'controller' => 'ServiciosAcabado', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('tarifamanipuladolineas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
$routes->get('', 'Tarifamanipuladolineas::index', ['as' => 'tarifaManipuladoLineaList']);
|
||||
$routes->get('add', 'Tarifamanipuladolineas::add', ['as' => 'newTarifaManipuladoLinea']);
|
||||
@ -152,42 +148,24 @@ $routes->group('tipologiaslibros', ['namespace' => 'App\Controllers\Configuracio
|
||||
$routes->group('imposiciones', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Imposiciones::index', ['as' => 'imposicionList']);
|
||||
$routes->get('add', 'Imposiciones::add', ['as' => 'newImposicion']);
|
||||
$routes->post('add', 'Imposiciones::add', ['as' => 'createImposicion']);
|
||||
$routes->get('add/esquema', 'Imposiciones::add_esquema', ['as' => 'newImposicionEsquema']);
|
||||
$routes->get('find/(:num)', 'Imposiciones::find_imposicion/$1', ['as' => 'findImposicion']);
|
||||
$routes->get('esquema/find/(:num)', 'Imposiciones::find_imposicion_esquema/$1', ['as' => 'findImposicionEsquema']);
|
||||
$routes->post('create', 'Imposiciones::create', ['as' => 'ajaxCreateImposicion']);
|
||||
$routes->put('(:num)/update', 'Imposiciones::update/$1', ['as' => 'ajaxUpdateImposicion']);
|
||||
$routes->post('(:num)/edit', 'Imposiciones::edit/$1', ['as' => 'updateImposicion']);
|
||||
$routes->post('datatable', 'Imposiciones::datatable', ['as' => 'dataTableOfImposiciones']);
|
||||
$routes->post('esquema/create', 'Imposiciones::create_imposicion_esquema', ['as' => 'ajaxCreateImposicionEsquema']);
|
||||
$routes->post('(:num)', 'Imposiciones::update/$1', ['as' => 'ajaxUpdateImposicion']);
|
||||
$routes->post('esquema/(:num)', 'Imposiciones::update_imposicion_esquema/$1', ['as' => 'ajaxUpdateImposicionEsquema']);
|
||||
$routes->delete('(:num)', 'Imposiciones::delete/$1', ['as' => 'deleteImposicion']);
|
||||
$routes->delete('esquema/(:num)', 'Imposiciones::delete_imposicion_esquema/$1', ['as' => 'deleteImposicionEsquema']);
|
||||
$routes->get('edit/(:num)', 'Imposiciones::edit/$1', ['as' => 'updateImposicionForm']);
|
||||
$routes->get('esquema/edit/(:num)', 'Imposiciones::edit_imposicion_esquema/$1', ['as' => 'updateImposicionEsquemaForm']);
|
||||
$routes->get('datatable', 'Imposiciones::datatable', ['as' => 'dataTableOfImposiciones']);
|
||||
$routes->get('esquema/datatable', 'Imposiciones::datatable_imposicion_esquema', ['as' => 'dataTableOfEsquemaImposiciones']);
|
||||
$routes->post('allmenuitems', 'Imposiciones::allItemsSelect', ['as' => 'select2ItemsOfImposiciones']);
|
||||
$routes->post('menuitems', 'Imposiciones::menuItems', ['as' => 'menuItemsOfImposiciones']);
|
||||
$routes->get('select', 'Imposiciones::selectImposicion', ['as' => 'selectImposicion']);
|
||||
$routes->get('esquema/select', 'Imposiciones::selectImposicionEsquema', ['as' => 'selectImposicionEsquema']);
|
||||
});
|
||||
$routes->resource('imposiciones', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Imposiciones', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('papelesgenericos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Papelesgenericos::index', ['as' => 'papelGenericoList']);
|
||||
$routes->delete('', 'Papelesgenericos::index', ['as' => 'papelGenericoList2']);
|
||||
$routes->get('add', 'Papelesgenericos::add', ['as' => 'newPapelGenerico']);
|
||||
$routes->post('add', 'Papelesgenericos::add', ['as' => 'createPapelGenerico']);
|
||||
$routes->post('create', 'Papelesgenericos::create', ['as' => 'ajaxCreatePapelGenerico']);
|
||||
$routes->put('(:num)/update', 'Papelesgenericos::update/$1', ['as' => 'ajaxUpdatePapelGenerico']);
|
||||
$routes->post('edit/(:num)', 'Papelesgenericos::edit/$1', ['as' => 'updatePapelGenerico']);
|
||||
$routes->post('datatable', 'Papelesgenericos::datatable', ['as' => 'dataTableOfPapelesGenericos']);
|
||||
$routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
});
|
||||
$routes->resource('papelesgenericos', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesgenericos', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Papelesimpresion::index', ['as' => 'papelImpresionList']);
|
||||
$routes->get('add', 'Papelesimpresion::add', ['as' => 'newPapelImpresion']);
|
||||
$routes->post('add', 'Papelesimpresion::add', ['as' => 'createPapelImpresion']);
|
||||
$routes->post('create', 'Papelesimpresion::create', ['as' => 'ajaxCreatePapelImpresion']);
|
||||
$routes->put('(:num)/update', 'Papelesimpresion::update/$1', ['as' => 'ajaxUpdatePapelImpresion']);
|
||||
$routes->post('edit/(:num)', 'Papelesimpresion::edit/$1', ['as' => 'updatePapelImpresion']);
|
||||
$routes->post('datatable', 'Papelesimpresion::datatable', ['as' => 'dataTableOfPapelesImpresion']);
|
||||
$routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']);
|
||||
$routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']);
|
||||
});
|
||||
$routes->resource('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesimpresion', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('papelimpresiontipologias', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('add', 'Papelimpresiontipologias::add', ['as' => 'newPapelImpresionTipologia']);
|
||||
@ -206,20 +184,6 @@ $routes->group('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Conf
|
||||
});
|
||||
$routes->resource('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelimpresionmargenes', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('maquinas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Maquinas::index', ['as' => 'maquinaList']);
|
||||
$routes->get('add', 'Maquinas::add', ['as' => 'newMaquina']);
|
||||
$routes->post('add', 'Maquinas::add', ['as' => 'createMaquina']);
|
||||
$routes->post('create', 'Maquinas::create', ['as' => 'ajaxCreateMaquina']);
|
||||
$routes->put('update/(:num)', 'Maquinas::update/$1', ['as' => 'ajaxUpdateMaquina']);
|
||||
$routes->post('edit/(:num)', 'Maquinas::edit/$1', ['as' => 'updateMaquina']);
|
||||
$routes->post('datatable', 'Maquinas::datatable', ['as' => 'dataTableOfMaquinas']);
|
||||
$routes->post('allmenuitems', 'Maquinas::allItemsSelect', ['as' => 'select2ItemsOfMaquinas']);
|
||||
$routes->post('menuitems', 'Maquinas::menuItems', ['as' => 'menuItemsOfMaquinas']);
|
||||
});
|
||||
$routes->resource('maquinas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinas', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Maquinastarifasimpresion::index', ['as' => 'maquinasTarifaImpresionList']);
|
||||
$routes->get('add', 'Maquinastarifasimpresion::add', ['as' => 'newMaquinasTarifaImpresion']);
|
||||
@ -253,24 +217,11 @@ $routes->group('maquinaspapelesimpresion', ['namespace' => 'App\Controllers\Conf
|
||||
$routes->resource('maquinastarifasimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinastarifasimpresion', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('maquinasdefecto', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Maquinasdefecto::index', ['as' => 'maquinaPorDefectoList']);
|
||||
$routes->get('add', 'Maquinasdefecto::add', ['as' => 'newMaquinaPorDefecto']);
|
||||
$routes->post('add', 'Maquinasdefecto::add', ['as' => 'createMaquinaPorDefecto']);
|
||||
$routes->post('create', 'Maquinasdefecto::create', ['as' => 'ajaxCreateMaquinaPorDefecto']);
|
||||
$routes->put('(:num)/update', 'Maquinasdefecto::update/$1', ['as' => 'ajaxUpdateMaquinaPorDefecto']);
|
||||
$routes->post('edit/(:num)', 'Maquinasdefecto::edit/$1', ['as' => 'updateMaquinaPorDefecto']);
|
||||
$routes->post('datatable', 'Maquinasdefecto::datatable', ['as' => 'dataTableOfMaquinasPorDefecto']);
|
||||
$routes->post('allmenuitems', 'Maquinasdefecto::allItemsSelect', ['as' => 'select2ItemsOfMaquinasPorDefecto']);
|
||||
$routes->post('menuitems', 'Maquinasdefecto::menuItems', ['as' => 'menuItemsOfMaquinasPorDefecto']);
|
||||
});
|
||||
$routes->resource('maquinasdefecto', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Maquinasdefecto', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('profile', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||
$routes->get('', 'Profile::index', ['as' => 'profileList']);
|
||||
$routes->get('index', 'Profile::index', ['as' => 'profileIndex']);
|
||||
$routes->get('list', 'Profile::index', ['as' => 'profileList2']);
|
||||
$routes->match(['get', 'post'], 'store', 'Profile::store', ['as' => 'profileStore']);
|
||||
});
|
||||
|
||||
|
||||
@ -284,22 +235,20 @@ $routes->group('comunidades-autonomas', ['namespace' => 'App\Controllers\Configu
|
||||
$routes->post('datatable', 'Comunidadesautonomas::datatable', ['as' => 'dataTableOfComunidadesAutonomas']);
|
||||
$routes->post('allmenuitems', 'Comunidadesautonomas::allItemsSelect', ['as' => 'select2ItemsOfComunidadesAutonomas']);
|
||||
$routes->post('menuitems', 'Comunidadesautonomas::menuItems', ['as' => 'menuItemsOfComunidadesAutonomas']);
|
||||
$routes->get('menuitems2', 'Comunidadesautonomas::menuItems2', ['as' => 'menuItemsOfComunidadesAutonomas2']);
|
||||
});
|
||||
$routes->resource('comunidades-autonomas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Comunidadesautonomas', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Paises::index', ['as' => 'paisList']);
|
||||
$routes->get('add', 'Paises::add', ['as' => 'newPais']);
|
||||
$routes->post('add', 'Paises::add', ['as' => 'createPais']);
|
||||
$routes->post('create', 'Paises::create', ['as' => 'ajaxCreatePais']);
|
||||
$routes->put('(:num)/update', 'Paises::update/$1', ['as' => 'ajaxUpdatePais']);
|
||||
$routes->post('(:num)/edit', 'Paises::edit/$1', ['as' => 'updatePais']);
|
||||
$routes->post('datatable', 'Paises::datatable', ['as' => 'dataTableOfPaises']);
|
||||
$routes->post('allmenuitems', 'Paises::allItemsSelect', ['as' => 'select2ItemsOfPaises']);
|
||||
$routes->post('menuitems', 'Paises::menuItems', ['as' => 'menuItemsOfPaises']);
|
||||
$routes->group('formas-pago', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'FormasPago::index', ['as' => 'formasPagoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'FormasPago::add', ['as' => 'formasPagoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'FormasPago::edit/$1', ['as' => 'formasPagoEdit']);
|
||||
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
|
||||
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
|
||||
$routes->get('menuitems', 'FormasPago::menuItems', ['as' => 'menuItemsOfFormasDePagos']);
|
||||
});
|
||||
$routes->resource('paises', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Paises', 'except' => 'show,new,create,update']);
|
||||
$routes->resource('formas-pago', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'FormasPago', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('provincias', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
@ -312,6 +261,7 @@ $routes->group('provincias', ['namespace' => 'App\Controllers\Configuracion'], f
|
||||
$routes->post('datatable', 'Provincias::datatable', ['as' => 'dataTableOfProvincias']);
|
||||
$routes->post('allmenuitems', 'Provincias::allItemsSelect', ['as' => 'select2ItemsOfProvincias']);
|
||||
$routes->post('menuitems', 'Provincias::menuItems', ['as' => 'menuItemsOfProvincias']);
|
||||
$routes->get('menuitems2', 'Provincias::menuItems2', ['as' => 'menuItemsOfProvincias2']);
|
||||
});
|
||||
$routes->resource('provincias', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Provincias', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -322,42 +272,25 @@ $routes->group('clientes', ['namespace' => 'App\Controllers\Clientes'], function
|
||||
/* Cliente */
|
||||
$routes->group('cliente', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->get('', 'Cliente::index', ['as' => 'clienteList']);
|
||||
$routes->get('edit/(:num)', 'Cliente::edit/$1', ['as' => 'editarCliente']);
|
||||
$routes->match(['get', 'post'], 'add', 'Cliente::add', ['as' => 'clienteAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'Cliente::edit/$1', ['as' => 'clienteEdit']);
|
||||
$routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'clienteDelete']);
|
||||
$routes->post('datatable', 'Cliente::datatable', ['as' => 'clienteDT']);
|
||||
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
|
||||
$routes->get('getSelect2', 'Cliente::getSelect2', ['as' => 'getListaSelect2']);
|
||||
});
|
||||
|
||||
/* Precios */
|
||||
/*$routes->group('precios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->post('datatable', 'ClientePrecios::datatable', ['as' => 'clientePreciosDT']);
|
||||
$routes->post('datatable_editor', 'ClientePrecios::datatable_editor', ['as' => 'clientePreciosDTE']);
|
||||
});*/
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
/*$routes->group('cliente', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->get('', 'Cliente::index', ['as' => 'clienteList']);
|
||||
$routes->get('add', 'Cliente::add', ['as' => 'newCliente']);
|
||||
$routes->post('add', 'Cliente::add', ['as' => 'createCliente']);
|
||||
$routes->post('create', 'Cliente::create', ['as' => 'ajaxCreateCliente']);
|
||||
$routes->put('(:num)/update', 'Cliente::update/$1', ['as' => 'ajaxUpdateCliente']);
|
||||
$routes->post('edit/(:num)', 'Cliente::edit/$1', ['as' => 'updateCliente']);
|
||||
$routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'deleteCliente']);
|
||||
$routes->post('datatable', 'Cliente::datatable', ['as' => 'dataTableOfClientes']);
|
||||
$routes->post('allmenuitems', 'Cliente::allItemsSelect', ['as' => 'select2ItemsOfClientes']);
|
||||
|
||||
});
|
||||
$routes->resource('cliente', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Cliente', 'except' => 'show,new,create,update']);*/
|
||||
|
||||
$routes->group('clienteprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->post('datatable', 'Clienteprecios::datatable', ['as' => 'dataTableOfClienteprecios']);
|
||||
$routes->post('datatable_editor', 'Clienteprecios::datatable_editor', ['as' => 'editorOfClienteprecios']);
|
||||
$routes->post('datatable', 'ClientePrecios::datatable', ['as' => 'dataTableOfClienteprecios']);
|
||||
$routes->post('datatable_editor', 'ClientePrecios::datatable_editor', ['as' => 'editorOfClienteprecios']);
|
||||
$routes->post('changeplantilla', 'ClientePrecios::updatePlantilla', ['as' => 'changePlantillaOfClienteprecios']);
|
||||
$routes->get('getplantilla', 'ClientePrecios::getCurrentPlantilla', ['as' => 'getPlantillaOfClienteprecios']);
|
||||
$routes->post('update', 'ClientePrecios::updatePlantilla', ['as' => 'updateClienteprecios']);
|
||||
});
|
||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteprecios', 'except' => 'show,new,create,update']);
|
||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'ClientePrecios', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
@ -365,36 +298,39 @@ $routes->group('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clien
|
||||
$routes->get('add', 'Clienteplantillaprecios::add', ['as' => 'newClienteplantillaprecios']);
|
||||
$routes->post('add', 'Clienteplantillaprecios::add', ['as' => 'createClienteplantillaprecios']);
|
||||
$routes->post('edit/(:num)', 'Clienteplantillaprecios::edit/$1', ['as' => 'updateClienteplantillaprecios']);
|
||||
$routes->get('edit/(:num)', 'Clienteplantillaprecios::edit/$1', ['as' => 'updateClienteplantillaprecios']);
|
||||
$routes->get('delete/(:num)', 'Clienteplantillaprecios::delete/$1', ['as' => 'deleteClienteplantillaprecios']);
|
||||
$routes->post('datatable', 'Clienteplantillaprecios::datatable', ['as' => 'dataTableOfClientesplantillaprecios']);
|
||||
$routes->post('menuitems', 'Clienteplantillaprecios::menuItems', ['as' => 'menuItemsOfClienteplantillaprecios']);
|
||||
$routes->get('menuitems', 'Clienteplantillaprecios::menuItems', ['as' => 'menuItemsOfClienteplantillaprecios']);
|
||||
$routes->post('update/(:num)', 'Clienteplantillaprecios::update/$1', ['as' => 'updateClienteplantillaprecios']);
|
||||
});
|
||||
$routes->resource('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteplantillaprecios', 'except' => 'show,new,create,update']);
|
||||
$routes->resource('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteplantillaprecios', 'except' => 'show,new,create']);
|
||||
|
||||
|
||||
$routes->group('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->post('datatable', 'Clienteplantillaprecioslineas::datatable', ['as' => 'dataTableOfClientesplantillaprecioslineas']);
|
||||
$routes->post('datatable_editor', 'Clienteplantillaprecioslineas::datatable_editor', ['as' => 'editorOfClienteplantillaprecioslineas']);
|
||||
$routes->post('getrows', 'Clienteplantillaprecioslineas::getStoredRows', ['as' => 'getStoredRowsOfClienteplantillaprecioslineas']);
|
||||
});
|
||||
$routes->resource('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'clienteplantillaprecioslineas', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('clienteusuarios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->post('datatable', 'Clienteusuarios::datatable', ['as' => 'dataTableOfClienteUsuarios']);
|
||||
$routes->post('adduser', 'Clienteusuarios::addUserToClient');
|
||||
$routes->get('delete/(:num)', 'Clienteusuarios::removeClienteFromUser/$1');
|
||||
$routes->get('getusers', 'Clienteusuarios::getAvailableUsers');
|
||||
});
|
||||
|
||||
|
||||
$routes->group('formas-pagos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Formaspagos::index', ['as' => 'formaDePagoList']);
|
||||
$routes->get('add', 'Formaspagos::add', ['as' => 'newFormaDePago']);
|
||||
$routes->post('add', 'Formaspagos::add', ['as' => 'createFormaDePago']);
|
||||
$routes->post('create', 'Formaspagos::create', ['as' => 'ajaxCreateFormaDePago']);
|
||||
$routes->put('(:num)/update', 'Formaspagos::update/$1', ['as' => 'ajaxUpdateFormaDePago']);
|
||||
$routes->post('(:num)/edit', 'Formaspagos::edit/$1', ['as' => 'updateFormaDePago']);
|
||||
$routes->post('datatable', 'Formaspagos::datatable', ['as' => 'dataTableOfFormasDePagos']);
|
||||
$routes->post('allmenuitems', 'Formaspagos::allItemsSelect', ['as' => 'select2ItemsOfFormasDePagos']);
|
||||
$routes->post('menuitems', 'Formaspagos::menuItems', ['as' => 'menuItemsOfFormasDePagos']);
|
||||
$routes->group('misdirecciones', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->get('', 'Clientedirecciones::index', ['as' => 'clientedireccionesIndex']);
|
||||
$routes->get('get/(:num)', 'Clientedirecciones::get/$1', ['as' => 'get']);
|
||||
$routes->get('getDireccionPresupuesto/(:num)', 'Clientedirecciones::getDireccionPresupuesto/$1', ['as' => 'getDireccionPresupuesto']);
|
||||
$routes->post('add', 'Clientedirecciones::add', ['as' => 'newClientedirecciones']);
|
||||
$routes->get('getSelect2', 'Clientedirecciones::getSelect2', ['as' => 'listaClientedirecciones']);
|
||||
});
|
||||
$routes->resource('formas-pagos', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Formaspagos', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
|
||||
$routes->group('tarifasencuadernacion', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
$routes->get('', 'Tarifasencuadernacion::index', ['as' => 'tarifaEncuadernacionList']);
|
||||
@ -407,6 +343,7 @@ $routes->group('tarifasencuadernacion', ['namespace' => 'App\Controllers\Tarifas
|
||||
$routes->post('datatable', 'Tarifasencuadernacion::datatable', ['as' => 'dataTableOfTarifasEncuadernacion']);
|
||||
$routes->post('allmenuitems', 'Tarifasencuadernacion::allItemsSelect', ['as' => 'select2ItemsOfTarifasEncuadernacion']);
|
||||
$routes->post('menuitems', 'Tarifasencuadernacion::menuItems', ['as' => 'menuItemsOfTarifasEncuadernacion']);
|
||||
$routes->get('gettarifas', 'Tarifasencuadernacion::getSelect2');
|
||||
});
|
||||
$routes->resource('tarifasencuadernacion', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasencuadernacion', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -475,22 +412,7 @@ $routes->group('tarifasenvioszonas', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->resource('tarifasenvioszonas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasenvioszonas', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('proveedores', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
|
||||
$routes->get('', 'Proveedores::index', ['as' => 'proveedorList']);
|
||||
$routes->get('add', 'Proveedores::add', ['as' => 'newProveedor']);
|
||||
$routes->post('add', 'Proveedores::add', ['as' => 'createProveedor']);
|
||||
$routes->post('create', 'Proveedores::create', ['as' => 'ajaxCreateProveedor']);
|
||||
$routes->put('(:num)/update', 'Proveedores::update/$1', ['as' => 'ajaxUpdateProveedor']);
|
||||
$routes->post('edit/(:num)', 'Proveedores::edit/$1', ['as' => 'updateProveedor']);
|
||||
$routes->post('datatable', 'Proveedores::datatable', ['as' => 'dataTableOfProveedores']);
|
||||
$routes->post('allmenuitems', 'Proveedores::allItemsSelect', ['as' => 'select2ItemsOfProveedores']);
|
||||
$routes->post('menuitems', 'Proveedores::menuItems', ['as' => 'menuItemsOfProveedores']);
|
||||
});
|
||||
$routes->resource('proveedores', ['namespace' => 'App\Controllers\Compras', 'controller' => 'Proveedores', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('proveedorestipos', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
|
||||
$routes->post('menuitems', 'ProveedoresTipos::menuItems', ['as' => 'menuItemsOfProveedoresTipos']);
|
||||
});
|
||||
|
||||
$routes->resource('proveedorestipos', ['namespace' => 'App\Controllers\Compras', 'controller' => 'ProveedoresTipos', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -519,60 +441,45 @@ $routes->group('clientedirecciones', ['namespace' => 'App\Controllers\Clientes']
|
||||
$routes->resource('clientedirecciones', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clientedirecciones', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('list/(:num)', 'Cosidotapablanda::list/$1', ['as' => 'cosidotapablandaList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'newCosidotapablanda']);
|
||||
$routes->post('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'createCosidotapablanda']);
|
||||
$routes->post('create', 'Cosidotapablanda::create', ['as' => 'ajaxCreateCosidotapablanda']);
|
||||
$routes->put('(:num)/update', 'Cosidotapablanda::update/$1', ['as' => 'ajaxUpdateCosidotapablanda']);
|
||||
$routes->post('edit/(:num)', 'Cosidotapablanda::edit/$1', ['as' => 'updateCosidotapablanda']);
|
||||
$routes->post('datatable', 'Cosidotapablanda::datatable', ['as' => 'dataTableOfCosidotapablanda']);
|
||||
$routes->post('datatable_2', 'Cosidotapablanda::datatable_2', ['as' => 'updateDataOfCosidotapablanda']);
|
||||
$routes->post('allmenuitems', 'Cosidotapablanda::allItemsSelect', ['as' => 'select2ItemsOfCosidotapablanda']);
|
||||
$routes->post('menuitems', 'Cosidotapablanda::menuItems', ['as' => 'menuItemsOfCosidotapablanda']);
|
||||
});
|
||||
$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('list/(:num)', 'Presupuestocliente::list/$1', ['as' => 'listarPresupuestoCliente']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add', 'Presupuestocliente::add', ['as' => 'nuevoPresupuestoCliente']);
|
||||
$routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']);
|
||||
$routes->post('edit/(:num)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente']);
|
||||
$routes->post('datatable', 'Cosidotapablanda::datatable', ['as' => 'tablaPresupuestosCliente']);
|
||||
$routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']);
|
||||
$routes->post('presupuesto', 'Presupuestocliente::presupuesto', ['as' => 'presupuestoCliente']);
|
||||
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
|
||||
$routes->post('getDatosDireccion', 'Presupuestocliente::getDatosDireccion', ['as' => 'getDatosDireccion']);
|
||||
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
|
||||
});
|
||||
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('datatable', 'Presupuestoacabados::datatable', ['as' => 'dataTableOfPresupuestoAcabados']);
|
||||
$routes->get('getacabados', 'Presupuestoacabados::getAcabados');
|
||||
$routes->post('getvalues', 'Presupuestoacabados::getRowValues');
|
||||
$routes->post('menuitems', 'Presupuestoacabados::menuItems', ['as' => 'menuItemsOfPresupuestoAcabados']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoacabados::edit/$1', ['as' => 'updatePresupuestoacabados']);
|
||||
$routes->get('cargar', 'Presupuestoacabados::cargar');
|
||||
$routes->post('update/(:num)', 'Presupuestoacabados::update/$1');
|
||||
});
|
||||
|
||||
|
||||
$routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('datatable', 'Presupuestoencuadernaciones::datatable', ['as' => 'dataTableOfPresupuestoEncuadernaciones']);
|
||||
$routes->post('getvalues', 'Presupuestoencuadernaciones::getRowValues');
|
||||
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
|
||||
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
|
||||
|
||||
$routes->post('update/(:num)', 'Presupuestoencuadernaciones::update/$1');
|
||||
});
|
||||
|
||||
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('getvalues', 'Presupuestomanipulados::getRowValues');
|
||||
$routes->post('datatable', 'Presupuestomanipulados::datatable', ['as' => 'dataTableOfPresupuestoManipulados']);
|
||||
$routes->post('edit/(:num)', 'Presupuestomanipulados::edit/$1', ['as' => 'updatePresupuestomanipulados']);
|
||||
$routes->post('update/(:num)', 'Presupuestomanipulados::update/$1');
|
||||
$routes->get('serviciosolapas', 'Presupuestomanipulados::getServicioSolapas');
|
||||
});
|
||||
|
||||
$routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('getvalues', 'Presupuestopreimpresiones::getRowValues');
|
||||
$routes->post('datatable', 'Presupuestopreimpresiones::datatable', ['as' => 'dataTableOfPresupuestoPreimpresiones']);
|
||||
$routes->post('edit/(:num)', 'Presupuestopreimpresiones::edit/$1', ['as' => 'updatePresupuestopreimpresiones']);
|
||||
$routes->get('cargar', 'Presupuestopreimpresiones::getSelect2');
|
||||
});
|
||||
|
||||
$routes->group('serviciosextra', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('datatable', 'Presupuestoserviciosextra::datatable', ['as' => 'dataTableOfPresupuestoServiciosExtra']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoserviciosextra::edit/$1', ['as' => 'updatePresupuestoServiciosExtra']);
|
||||
$routes->post('getvalues', 'Presupuestoserviciosextra::getRowValues');
|
||||
});
|
||||
|
||||
$routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
@ -583,8 +490,74 @@ $routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presup
|
||||
$routes->group('presupuestotiradasalternativas', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->post('datatable', 'Presupuestotiradasalternativas::datatable', ['as' => 'dataTableOfPresupuestoTiradasAlternativas']);
|
||||
$routes->post('datatable_2', 'Presupuestotiradasalternativas::datatable_2', ['as' => 'getTiradaData']);
|
||||
});
|
||||
});
|
||||
|
||||
$routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function ($routes) {
|
||||
$routes->get('list', 'Pedido::todos', ['as' => 'listaPedidos']);
|
||||
$routes->get('activos', 'Pedido::activos', ['as' => 'listaPedidosActivos']);
|
||||
$routes->get('finalizados', 'Pedido::finalizados', ['as' => 'listaPedidosFinalizados']);
|
||||
$routes->get('cancelados', 'Pedido::cancelados', ['as' => 'listaPedidosCancelados']);
|
||||
$routes->post('datatable', 'Pedido::datatable', ['as' => 'dataTableOfPedidos']);
|
||||
$routes->get('add', 'Pedido::add', ['as' => 'nuevoPedido']);
|
||||
$routes->post('add', 'Pedido::add', ['as' => 'crearPedido']);
|
||||
$routes->get('edit/(:any)', 'Pedido::edit/$1', ['as' => 'editarPedido']);
|
||||
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
|
||||
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
|
||||
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
|
||||
$routes->post('insertfactura', 'Pedido::addFactura');
|
||||
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
|
||||
$routes->post('produccion/(:num)', 'Pedido::to_produccion/$1', ['as' => 'toProduccion']);
|
||||
$routes->get('pedidosCliente', 'Pedido::tablaClienteForm');
|
||||
$routes->get('getSumCliente/(:num)', 'Pedido::obtenerTotalPedidosCliente/$1');
|
||||
$routes->get('validacion', 'Pedido::validacion', ['as' => 'validacionView']);
|
||||
});
|
||||
$routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('albaranes', ['namespace' => 'App\Controllers\Albaranes'], function ($routes) {
|
||||
$routes->post('generarAlbaran', 'Albaran::generateAlbaran', ['as' => 'generarAlbaran']);
|
||||
$routes->get('albaranesEnvio', 'Albaran::getAlbaranes');
|
||||
$routes->get('datatablesAlbaranLinea', 'Albaran::datatablesLineasAlbaran');
|
||||
$routes->post('updateAlbaran', 'Albaran::updateAlbaran');
|
||||
$routes->post('borrarAlbaranLinea', 'Albaran::borrarLinea');
|
||||
$routes->post('borrarAlbaran', 'Albaran::borrarAlbaran');
|
||||
$routes->post('updateAlbaranLinea', 'Albaran::updateAlbaranLinea');
|
||||
$routes->post('addIvaAlbaran', 'Albaran::addLineasIva');
|
||||
$routes->post('nuevaLineaAlbaran', 'Albaran::addBlankLineaAlbaran');
|
||||
$routes->get('datatable', 'Albaran::datatable', ['as' => 'dataTableOfAlbaranes']);
|
||||
$routes->get('getAlbaran', 'Albaran::getAlbaran');
|
||||
$routes->get('edit/(:num)', 'Albaran::editAlbaran/$1', ['as' => 'editarAlbaran']);
|
||||
});
|
||||
$routes->resource('albaranes', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Albaran', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('facturas', ['namespace' => 'App\Controllers\Facturacion'], function ($routes) {
|
||||
|
||||
$routes->get('list', 'Facturas::list', ['as' => 'facturasList']);
|
||||
$routes->get('datatable', 'Facturas::datatable', ['as' => 'dataTableOfFacturas']);
|
||||
$routes->get('add', 'Facturas::add', ['as' => 'newFactura']);
|
||||
$routes->post('add', 'Facturas::add', ['as' => 'createFactura']);
|
||||
$routes->get('edit/(:any)', 'Facturas::edit/$1', ['as' => 'editarFactura']);
|
||||
$routes->get('validar/(:any)', 'Facturas::validar/$1', ['as' => 'validarFactura']);
|
||||
$routes->post('update/(:any)', 'Facturas::update/$1', ['as' => 'actualizarFactura']);
|
||||
$routes->post('duplicate/(:any)', 'Facturas::duplicate/$1', ['as' => 'duplicarFactura']);
|
||||
$routes->post('datatable/(:any)', 'FacturasLineas::datatable/$1', ['as' => 'dataTableOfLineasFacturas']);
|
||||
$routes->post('menuPedidosPendientes/(:num)', 'Facturas::menuPedidosPendientes/$1', ['as' => 'menuPedidosPendientesImpresion']);
|
||||
$routes->post('addLineaPedidoImpresion/(:num)', 'Facturas::addLineaPedidoImpresion/$1', ['as' => 'addLineaPedidoImpresion2Factura']);
|
||||
$routes->post('addExcedentes/(:any)', 'Facturas::addExcedentes/$1', ['as' => 'addLineaExcedentes']);
|
||||
$routes->get('deleteLinea/(:any)', 'FacturasLineas::deleteLinea/$1', ['as' => 'deleteLineaFactura']);
|
||||
$routes->get('delete/(:any)', 'Facturas::delete/$1', ['as' => 'borrarFactura']);
|
||||
$routes->post('deleteFacturaLineaPedido', 'Facturas::deleteLineaPedidoImpresion', ['as' => 'deleteLineaPedidoImpresion']);
|
||||
$routes->post('editorLineas', 'FacturasLineas::datatable_editor', ['as' => 'editorOfLineasFacturas']);
|
||||
$routes->post('updateTotales/(:any)', 'Facturas::updateTotales/$1', ['as' => 'updateFacturaTotales']);
|
||||
$routes->post('updateCabecera/(:any)', 'Facturas::updateCabecera/$1', ['as' => 'updateCabecera']);
|
||||
$routes->post('datatablePagos/(:any)', 'FacturasPagos::datatable/$1', ['as' => 'dataTableOfPagosFacturas']);
|
||||
$routes->post('conformarFactura', 'FacturasPagos::addPagoRectificativa');
|
||||
$routes->post('editorPagos', 'FacturasPagos::datatable_editor', ['as' => 'editorOfPagosFacturas']);
|
||||
$routes->post('deleteFacturaLineaPago', 'Facturas::deleteLineaPago', ['as' => 'deleteLineaPago']);
|
||||
$routes->post('datatablePedidos', 'Facturas::datatablePedidos', ['as' => 'dataTableOfFacturasPedido']);
|
||||
$routes->get('getdatoscliente/(:any)', 'Facturas::getDatosFacturacionClienteForm/$1');
|
||||
});
|
||||
|
||||
|
||||
$routes->group(
|
||||
@ -597,16 +570,347 @@ $routes->group(
|
||||
);
|
||||
|
||||
$routes->group(
|
||||
'buscadorpresupuestos',
|
||||
'print-albaran',
|
||||
['namespace' => 'App\Controllers\Pdf'],
|
||||
function ($routes) {
|
||||
$routes->get('index/(:num)', 'PrintAlbaranes::index/$1', ['as' => 'viewAlbaranPDF']);
|
||||
$routes->get('generar/(:num)', 'PrintAlbaranes::generar/$1', ['as' => 'albaranToPdf']);
|
||||
}
|
||||
);
|
||||
|
||||
$routes->group(
|
||||
'print-factura',
|
||||
['namespace' => 'App\Controllers\Pdf'],
|
||||
function ($routes) {
|
||||
$routes->get('index/(:num)', 'PrintFacturas::index/$1', ['as' => 'viewFacturaPDF']);
|
||||
$routes->get('generar/(:num)', 'PrintFacturas::generar/$1', ['as' => 'facturaToPdf']);
|
||||
}
|
||||
);
|
||||
|
||||
$routes->group(
|
||||
'export-giros',
|
||||
['namespace' => 'App\Controllers\Excel'],
|
||||
function ($routes) {
|
||||
$routes->get('generar/(:num)', 'PrintGiros::generateExcel/$1', ['as' => 'girosToExcel']);
|
||||
}
|
||||
);
|
||||
|
||||
$routes->group(
|
||||
'export-lineas',
|
||||
['namespace' => 'App\Controllers\Excel'],
|
||||
function ($routes) {
|
||||
$routes->get('generar/(:num)', 'PrintLineas::generateExcel/$1', ['as' => 'lineasToExcel']);
|
||||
}
|
||||
);
|
||||
|
||||
$routes->group(
|
||||
'presupuestos',
|
||||
['namespace' => 'App\Controllers\Presupuestos'],
|
||||
function ($routes) {
|
||||
$routes->get('', 'Buscador::list', ['as' => 'buscadorPresupuestosList']);
|
||||
$routes->get('buscador', 'Buscador::index', ['as' => 'buscadorPresupuestosList']);
|
||||
$routes->post('datatable', 'Buscador::datatable', ['as' => 'dataTableOfBuscador']);
|
||||
}
|
||||
);
|
||||
$routes->resource('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Buscador', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group(
|
||||
'papel-formato',
|
||||
['namespace' => 'App\Controllers\Configuracion'],
|
||||
function ($routes) {
|
||||
$routes->post('menuitems', 'Papelformato::menuitems', ['as' => 'menuitems']);
|
||||
$routes->get('getSelect2', 'Papelformato::getSelect2', ['as' => 'getSelect2']);
|
||||
}
|
||||
);
|
||||
$routes->resource('papel-formato', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelformato', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
|
||||
/* Rutas para mensajeria */
|
||||
$routes->group('mensajes', ['namespace' => 'App\Controllers\Mensajeria'], function ($routes) {
|
||||
|
||||
/* Interna */
|
||||
$routes->group('internos', ['namespace' => 'App\Controllers\Mensajeria'], function ($routes) {
|
||||
|
||||
$routes->get('', 'MensajesDirectos::index', ['as' => 'mensajeriaView']);
|
||||
$routes->get('chat/(:num)', 'MensajesDirectos::getChatInfo/$1', ['as' => 'getChatInfo']);
|
||||
/*$routes->match(['get', 'post'], 'add', 'TarifaAcabados::add', ['as' => 'tarifaAcabadoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
|
||||
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
|
||||
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);*/
|
||||
});
|
||||
});
|
||||
$routes->group('messages', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||
$routes->get('datatable', 'ChatController::datatable_messages', ['as' => 'getDatatableMessages']);
|
||||
$routes->get('datatable/presupuesto', 'ChatController::datatable_presupuesto_messages', ['as' => 'getDatatablePresupuestoMessages']);
|
||||
$routes->get('datatable/pedido', 'ChatController::datatable_pedido_messages', ['as' => 'getDatatablePedidoMessages']);
|
||||
$routes->get('datatable/factura', 'ChatController::datatable_factura_messages', ['as' => 'getDatatableFacturaMessages']);
|
||||
$routes->get('datatable/ots', 'ChatController::datatable_ot_messages', ['as' => 'getDatatableOtMessages']);
|
||||
$routes->get('datatable/direct', 'ChatController::datatable_direct_messages', ['as' => 'getDatatableDirectMessages']);
|
||||
|
||||
|
||||
$routes->post('direct', 'ChatController::store_new_direct_message', ['as' => 'storeNewDirectMessage']);
|
||||
$routes->post('direct/client', 'ChatController::store_new_direct_message_client', ['as' => 'storeNewDirectMessageClient']);
|
||||
});
|
||||
$routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||
|
||||
$routes->get('direct/(:num)', 'ChatController::get_chat_direct_view/$1', ['as' => 'getChatDirectView']);
|
||||
$routes->get('presupuesto/(:num)', 'ChatController::get_chat_presupuesto_view/$1', ['as' => 'getChatPresupuestoView']);
|
||||
$routes->get('pedido/(:num)', 'ChatController::get_chat_pedido_view/$1', ['as' => 'getChatPedidoView']);
|
||||
$routes->get('factura/(:num)', 'ChatController::get_chat_factura_view/$1', ['as' => 'getChatFacturaView']);
|
||||
$routes->get('ot/(:num)', 'ChatController::get_chat_ot_view/$1', ['as' => 'getChatOtView']);
|
||||
|
||||
|
||||
$routes->get('direct/conversation/(:num)', 'ChatController::get_chat_direct/$1', ['as' => 'getChatDirect']);
|
||||
$routes->get('direct/users/select/(:num)', 'ChatController::get_chat_direct_select_users/$1', ['as' => 'getChatDirectSelectUsers']);
|
||||
|
||||
$routes->get('direct/client/users/select/presupuesto/(:num)', 'ChatController::get_presupuesto_client_users/$1/$2', ['as' => 'getPresupuestoClientUsers']);
|
||||
$routes->get('direct/client/users/select/pedido/(:num)', 'ChatController::get_pedido_client_users/$1/$2', ['as' => 'getPedidoClientUsers']);
|
||||
$routes->get('direct/client/users/select/factura/(:num)', 'ChatController::get_factura_client_users/$1/$2', ['as' => 'getFacturaClientUsers']);
|
||||
$routes->get('direct/client/users/select/ot/(:num)', 'ChatController::get_orden_trabajo_client_users/$1/$2', ['as' => 'getOrdenTrabajoClientUsers']);
|
||||
|
||||
|
||||
$routes->get('direct/users/(:num)', 'ChatController::get_chat_direct_users', ['as' => 'getChatDirectUsers']);
|
||||
$routes->post('direct/users/(:num)', 'ChatController::store_chat_direct_users/$1', ['as' => 'storeChatDirectUsers']);
|
||||
$routes->get('direct/messages/(:num)', 'ChatController::get_chat_direct_messages/$1', ['as' => 'getChatDirectMessages']);
|
||||
$routes->post('direct/messages/(:num)', 'ChatController::store_chat_direct_message/$1', ['as' => 'storeChatDirectMessages']);
|
||||
$routes->post('direct/messages/unread/(:num)', 'ChatController::update_chat_direct_message_unread/$1', ['as' => 'updateChatDirectMessageUnread']);
|
||||
|
||||
|
||||
$routes->post('department', 'ChatController::store_chat_department', ['as' => 'storeChatDepartment']);
|
||||
$routes->delete('department/(:num)', 'ChatController::delete_chat_department/$1', ['as' => 'deleteChatDepartment']);
|
||||
$routes->post('department/update/(:num)', 'ChatController::update_chat_department/$1', ['as' => 'updateChatDepartment']);
|
||||
$routes->get('departments/(:alpha)/(:num)', 'ChatController::get_chat_departments/$1/$2', ['as' => 'getChatDepartments']);
|
||||
$routes->get('departments/select', 'ChatController::get_chat_department_select', ['as' => 'getChatDepartmentSelect']);
|
||||
$routes->get('department/presupuesto/(:num)/(:num)', 'ChatController::get_chat_presupuesto/$1/$2', ['as' => 'getChatPresupuesto']);
|
||||
$routes->get('department/pedido/(:num)/(:num)', 'ChatController::get_chat_pedido/$1/$2', ['as' => 'getChatPedido']);
|
||||
$routes->get('department/factura/(:num)/(:num)', 'ChatController::get_chat_factura/$1/$2', ['as' => 'getChatFactura']);
|
||||
$routes->get('department/ot/(:num)/(:num)', 'ChatController::get_chat_orden_trabajo/$1/$2', ['as' => 'getChatOrdenTrabajo']);
|
||||
$routes->get('department/users/presupuesto/(:num)/(:num)', 'ChatController::get_chat_department_presupuesto_users/$1/$2', ['as' => 'getPresupuestoChatDepartmentUsers']);
|
||||
$routes->get('department/users/ot/(:num)/(:num)', 'ChatController::get_chat_department_orden_trabajo_users/$1/$2', ['as' => 'getOrdenTrabajoChatDepartmentUsers']);
|
||||
|
||||
$routes->get('department/datatable', 'ChatController::chat_department_datatable', ['as' => 'chatDepartmentDatatable']);
|
||||
$routes->get('department/edit/(:num)', 'ChatController::chat_department_edit/$1', ['as' => 'chatDepartmentEditView']);
|
||||
$routes->get('department/users/datatable/(:num)', 'ChatController::chat_department_user_datatable/$1', ['as' => 'chatDepartmentUsersDatatable']);
|
||||
$routes->get('department/users/pedido/(:num)/(:num)', 'ChatController::get_chat_department_pedido_users/$1/$2', ['as' => 'getPedidoChatDepartmentUsers']);
|
||||
$routes->get('department/users/factura/(:num)/(:num)', 'ChatController::get_chat_department_factura_users/$1/$2', ['as' => 'getFacturaChatDepartmentUsers']);
|
||||
$routes->get('department/users/select/add/(:num)', 'ChatController::select_users_not_in_chat_department/$1', ['as' => 'selectUsersNotInChatDepartment']);
|
||||
$routes->post('department/user', 'ChatController::subscribe_to_chat_deparment/$1', ['as' => 'subscribeToChatDepartment']);
|
||||
$routes->post('department/subscribe/admin/user', 'ChatController::subscribe_admin_to_department', ['as' => 'subscribeAdminToChatDepartment']);
|
||||
$routes->delete('department/user/(:num)', 'ChatController::delete_user_from_department/$1', ['as' => 'deleteUserFromDepartment']);
|
||||
$routes->delete('department/admin/user/(:num)/(:num)', 'ChatController::delete_user_admin_from_department/$1/$2', ['as' => 'deleteUserAdminFromDepartment']);
|
||||
|
||||
|
||||
$routes->get('(:num)', 'ChatController::get_chat/$1', ['as' => 'getChat']);
|
||||
$routes->post('message/error/presupuesto', 'ChatController::store_chat_error_message', ['as' => 'storeChatErrorMessage']);
|
||||
$routes->post('message/(:alpha)', 'ChatController::store_message/$1', ['as' => 'storeChatMessage']);
|
||||
$routes->post('message/internal', 'ChatController::store_chat_message_single', ['as' => 'storeChatMessageSingle']);
|
||||
$routes->get('contacts', 'ChatController::get_chat_internal_contacts', ['as' => 'getChatInternalContacts']);
|
||||
$routes->get('contacts/(:num)', 'ChatController::get_chat_internal_contact/$1', ['as' => 'getChatInternalContact']);
|
||||
$routes->get('contact/(:num)/messages', 'ChatController::get_chat_internal_messages/$1', ['as' => 'getChatInternalMessages']);
|
||||
$routes->get('notifications', 'ChatController::get_chat_cliente/$1', ['as' => 'getChatCliente']);
|
||||
$routes->get('users/internal', 'ChatController::get_chat_users_internal', ['as' => 'getChatUsersInternal']);
|
||||
$routes->get('users/all', 'ChatController::get_chat_users_all', ['as' => 'getChatUsersAll']);
|
||||
|
||||
$routes->post('hebra/(:alpha)', 'ChatController::store_hebra/$1', ['as' => 'storeHebra']);
|
||||
$routes->post('hebra/(:num)', 'ChatController::update_hebra/$1', ['as' => 'updateHebra']);
|
||||
$routes->get('hebra/(:alpha)/(:num)', "ChatController::get_hebra/$1/$2", ["as" => "getHebra"]);
|
||||
|
||||
$routes->get('users/message/notifications-unviewed/(:num)', 'ChatController::get_notifications_not_viewed_from_message/$1');
|
||||
});
|
||||
|
||||
|
||||
$routes->group('messages', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||
$routes->get('datatable', 'ChatController::datatable_messages', ['as' => 'getDatatableMessages']);
|
||||
$routes->get('datatable/presupuesto', 'ChatController::datatable_presupuesto_messages', ['as' => 'getDatatablePresupuestoMessages']);
|
||||
$routes->get('datatable/pedido', 'ChatController::datatable_pedido_messages', ['as' => 'getDatatablePedidoMessages']);
|
||||
$routes->get('datatable/factura', 'ChatController::datatable_factura_messages', ['as' => 'getDatatableFacturaMessages']);
|
||||
|
||||
$routes->post('direct', 'ChatController::store_new_direct_message', ['as' => 'storeNewDirectMessage']);
|
||||
$routes->post('direct/client', 'ChatController::store_new_direct_message_client', ['as' => 'storeNewDirectMessageClient']);
|
||||
});
|
||||
|
||||
|
||||
$routes->group('soporte', ['namespace' => 'App\Controllers\Soporte'], function ($routes) {
|
||||
$routes->get('', 'Ticketcontroller::index', ['as' => 'TicketIndex']);
|
||||
$routes->get('add', 'Ticketcontroller::add', ['as' => 'NewTicket']);
|
||||
$routes->post('add', 'Ticketcontroller::add', ['as' => 'createTicket']);
|
||||
$routes->get('edit/(:num)', 'Ticketcontroller::edit/$1', ['as' => 'editTicket']);
|
||||
$routes->post('edit/(:num)', 'Ticketcontroller::edit/$1', ['as' => 'updateTicket']);
|
||||
$routes->post('ticketlist', 'Ticketcontroller::datatable');
|
||||
$routes->get('image/(:segment)', 'Ticketcontroller::image/$1');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
$routes->group('ordentrabajo', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
/** VIEWS */
|
||||
$routes->get('', 'Ordentrabajo::index', ['as' => 'viewOrdenTrabajoIndex']);
|
||||
$routes->get('edit/(:num)', 'Ordentrabajo::edit/$1', ['as' => 'viewOrdenTrabajoEdit']);
|
||||
|
||||
/** GET */
|
||||
$routes->get('summary/(:num)', 'Ordentrabajo::get_orden_trabajo_summary/$1', ['as' => 'getOrdenTrabajoSumary']);
|
||||
$routes->get("tarea/progress/(:num)", "Ordentrabajo::get_orden_trabajo_progress_date/$1");
|
||||
$routes->get('tarea/(:num)', 'Ordentrabajo::find_tarea/$1');
|
||||
$routes->get('tarea/dates/(:num)', 'Ordentrabajo::get_orden_trabajo_tareas_dates/$1');
|
||||
$routes->get('tareas/maquina/(:num)/(:num)','Ordentrabajo::get_tareas_ot_maquina/$1/$2');
|
||||
/** DATATABLES */
|
||||
$routes->get('datatable', 'Ordentrabajo::datatable');
|
||||
$routes->get('datatable_pendientes', 'Ordentrabajo::datatable_pendientes');
|
||||
$routes->get('datatable_ferro_pendiente', 'Ordentrabajo::datatable_ferro_pendiente');
|
||||
$routes->get('datatable_ferro_ok', 'Ordentrabajo::datatable_ferro_ok');
|
||||
$routes->get('datatable_news', 'Ordentrabajo::datatable_news');
|
||||
$routes->get('datatable_prod', 'Ordentrabajo::datatable_prod');
|
||||
$routes->get('datatable_waiting', 'Ordentrabajo::datatable_waiting');
|
||||
$routes->get('datatable_revision_com', 'Ordentrabajo::datatable_revision_com');
|
||||
$routes->get('tareas/datatable/(:num)', 'Ordentrabajo::tareas_datatable/$1', ['as' => 'datatableTareasOrdenTrabajo']);
|
||||
$routes->get('maquinas/ots/datatable/(:num)','Ordentrabajo::datatable_maquina_ordenes_trabajo/$1');
|
||||
$routes->get('maquinas/ots/(:num)','Ordentrabajo::get_maquina_ots/$1');
|
||||
|
||||
/**======================
|
||||
* UPDATES
|
||||
*========================**/
|
||||
$routes->post("update/tarea", 'Ordentrabajo::update_orden_trabajo_tarea');
|
||||
$routes->post("update/date", 'Ordentrabajo::update_orden_trabajo_date');
|
||||
$routes->post("reset/date", 'Ordentrabajo::reset_orden_trabajo_date');
|
||||
$routes->post("update/pedido/date", 'Ordentrabajo::update_orden_trabajo_pedido_date');
|
||||
$routes->post("reset/pedido/date", 'Ordentrabajo::reset_orden_trabajo_pedido_date');
|
||||
$routes->post("update/pod/pedido/date/(:num)", 'Ordentrabajo::update_pod_pedido_dates/$1');
|
||||
$routes->post("update/pedido", 'Ordentrabajo::update_orden_trabajo_pedido');
|
||||
$routes->post("update/user", 'Ordentrabajo::update_orden_trabajo_user');
|
||||
$routes->post("update", 'Ordentrabajo::update_orden_trabajo');
|
||||
$routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada');
|
||||
$routes->get("color/(:num)", 'Ordentrabajo::get_orden_trabajo_color_status/$1');
|
||||
$routes->post("update/tarea/progress", "Ordentrabajo::store_orden_trabajo_progress_date");
|
||||
$routes->post("update/tarea/pliegos", "Ordentrabajo::update_orden_trabajo_pliegos");
|
||||
$routes->post("update/tarea/proveedor", "Ordentrabajo::update_presupuesto_tarea_proveedor");
|
||||
$routes->post("fa/tareas/update", 'Ordentrabajo::update_orden_trabajo_fa_tareas');
|
||||
$routes->post("fa/tareas/reset",'Ordentrabajo::delete_orden_trabajo_fa_tareas');
|
||||
$routes->post('maquinas/ots','Ordentrabajo::store_maquina_ordenes_trabajo');
|
||||
$routes->post('maquinas/ots/estado','Ordentrabajo::update_maquina_ordenes_trabajo_estado');
|
||||
|
||||
|
||||
/**DELETES */
|
||||
$routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1');
|
||||
$routes->delete("tarea/progress/(:num)", "Ordentrabajo::delete_orden_trabajo_progress_date/$1");
|
||||
$routes->delete('reset/tareas/(:num)', 'Ordentrabajo::reset_tareas/$1');
|
||||
$routes->delete('tareas/(:num)', 'Ordentrabajo::delete_tarea/$1');
|
||||
$routes->delete('maquinas/ots/(:num)', 'Ordentrabajo::delete_maquina_orden_trabajo_tarea/$1');
|
||||
$routes->delete('maquinas/ots/all/(:num)', 'Ordentrabajo::delete_maquina_orden_trabajo_all/$1');
|
||||
/**======================
|
||||
* FILES
|
||||
*========================**/
|
||||
$routes->post('get_files', 'Ordentrabajo::get_files');
|
||||
$routes->post('upload_files', 'Ordentrabajo::upload_files');
|
||||
$routes->get('barcode/(:num)', 'Ordentrabajo::imprimir_codigo_safekat/$1', ['as' => "getOrdenTrabajoBarCode"]);
|
||||
/**======================
|
||||
* PDF
|
||||
*========================**/
|
||||
$routes->get('pdf/(:num)', 'Ordentrabajo::get_pdf/$1');
|
||||
$routes->get('pdf/content/(:num)', 'Ordentrabajo::get_ot_pdf_content/$1');
|
||||
$routes->get('pdf/ferro/(:num)', 'Ordentrabajo::get_ferro_pdf/$1');
|
||||
$routes->get('pdf/prototipo/(:num)', 'Ordentrabajo::get_prototipo_pdf/$1');
|
||||
$routes->get('portada/(:num)', 'Ordentrabajo::get_portada_img/$1');
|
||||
/** PLANNING */
|
||||
$routes->group('planning', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
$routes->get('select/maquina/rotativa', 'Ordentrabajo::select_maquina_planning_rot');
|
||||
$routes->get('select/papel/rotativa', 'Ordentrabajo::select_papel_planning_rot');
|
||||
$routes->get('select/maquina/plana', 'Ordentrabajo::select_maquina_planning_plana');
|
||||
$routes->get('select/maquina/padre/plana', 'Ordentrabajo::select_maquina_padre_planning_plana');
|
||||
$routes->get('select/papel/plana', 'Ordentrabajo::select_papel_planning_plana');
|
||||
$routes->get('rotativa', 'Ordentrabajo::index_planning_rotativa');
|
||||
$routes->get('papel/datatable', 'Ordentrabajo::papel_gramaje_datatable');
|
||||
$routes->get('papel/plana/datatable', 'Ordentrabajo::papel_pliego_datatable');
|
||||
$routes->get('maquina/plana/datatable', 'Ordentrabajo::maquina_plana_datatable');
|
||||
$routes->get('rotativa/datatable', 'Ordentrabajo::planning_rotativa_datatable');
|
||||
$routes->get('plana/datatable', 'Ordentrabajo::planning_plana_datatable');
|
||||
$routes->post('tarea/toggle/corte/(:num)', 'Ordentrabajo::tarea_toggle_corte/$1');
|
||||
});
|
||||
|
||||
$routes->group('maquinista', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
/**
|
||||
* VIEWS
|
||||
*/
|
||||
$routes->get('maquinas/view', 'Ordentrabajo::maquinista_maquinas_view', ['as' => 'viewProduccionMaquinistaMaquinas']);
|
||||
$routes->get('maquinas/view/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_list/$1', ['as' => 'viewProduccionMaquinaTareasList']);
|
||||
$routes->get('maquinas/view/auto/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_fichaje_automatico/$1', ['as' => 'viewMaquinistaFichajeAutomatico']);
|
||||
$routes->get('maquinas/view/scan/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_scan/$1', ['as' => 'viewMaquinistaTareaScan']);
|
||||
$routes->get('maquinas/view/tarea/(:num)', 'Ordentrabajo::maquinista_maquina_tarea_view/$1', ['as' => 'viewProduccionMaquinistaTareaView']);
|
||||
$routes->get('maquinas/view/maquina/ot/tareas/(:num)', 'Ordentrabajo::maquinista_maquina_ot_tareas_view/$1', ['as' => 'viewProduccionMaquinistaOtTareasView']);
|
||||
|
||||
$routes->get('colas/view', 'Ordentrabajo::maquinista_colas_view', ['as' => 'viewProduccionMaquinistaColas']);
|
||||
|
||||
/** DATATABLE */
|
||||
$routes->get('maquinas/tareas/datatable/(:alpha)/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_datatable/$1/$2', ['as' => 'viewMaquinistaMaquinaTareaDatatable']);
|
||||
$routes->get('maquinas/tareas/aplazadas/datatable/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_aplazada_datatable/$1', ['as' => 'viewMaquinistaMaquinaTareaAplazadaDatatable']);
|
||||
|
||||
/** POST */
|
||||
$routes->post('maquinas/tareas/printLabels', 'Ordentrabajo::printPackagingLabels');
|
||||
});
|
||||
});
|
||||
});
|
||||
$routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], function ($routes) {
|
||||
|
||||
$routes->get('print/label/test', 'LogisticaController::print_test_label');
|
||||
$routes->get('panel', 'LogisticaController::panel', ['as' => 'LogisticaPanel']);
|
||||
$routes->get('envios', 'LogisticaController::gestionEnvios', ['as' => 'gestionEnvios']);
|
||||
$routes->get('enviosFerros', 'LogisticaController::gestionEnviosFerros', ['as' => 'gestionEnviosFerros']);
|
||||
$routes->get('etiquetasLogistica', 'LogisticaController::etiquetasLogistica', ['as' => 'etiquetasLogistica']);
|
||||
$routes->get('datatableEnvios', 'LogisticaController::datatable_envios');
|
||||
$routes->get('datatableLineasEnvios/(:num)', 'LogisticaController::datatable_enviosEdit/$1');
|
||||
$routes->get('envio/(:num)', 'LogisticaController::editEnvio/$1');
|
||||
$routes->get('selectAddLinea', 'LogisticaController::selectAddEnvioLinea');
|
||||
$routes->get('addLineaEnvio', 'LogisticaController::addEnvioLinea');
|
||||
$routes->post('updateCajaLinea', 'LogisticaController::setCajaLinea');
|
||||
$routes->post('deleteLineasEnvio', 'LogisticaController::deleteLineas');
|
||||
$routes->post('updateLineaEnvio', 'LogisticaController::updateLineaEnvio');
|
||||
$routes->post('updateComentariosEnvio', 'LogisticaController::saveComments');
|
||||
$routes->post('updateCajasEnvio', 'LogisticaController::updateCajasEnvio');
|
||||
$routes->post('updateCodigoSeguimiento', 'LogisticaController::updateCodigoSeguimiento');
|
||||
$routes->post('updateProveedorEnvio', 'LogisticaController::updateProveedorEnvio');
|
||||
$routes->post('finalizarEnvio', 'LogisticaController::finalizarEnvio');
|
||||
$routes->post('generateEnvio', 'LogisticaController::generarEnvio');
|
||||
$routes->post('generateEnvioFerro', 'LogisticaController::generarEnvioFerro');
|
||||
$routes->get('selectForNewEnvio', 'LogisticaController::findForNewEnvio');
|
||||
$routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio');
|
||||
$routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas');
|
||||
$routes->post('ficharEmbalaje', 'LogisticaController::ficharEmbalaje');
|
||||
$routes->get('datatableProximosEnvios/(:num)', 'LogisticaController::datatable_proximosEnvios/$1');
|
||||
|
||||
$routes->get('listAlbaranes', 'LogisticaController::listAlbaranes', ['as' => 'albaranesList']);
|
||||
});
|
||||
|
||||
$routes->group('etiquetasTitulos', ['namespace' => 'App\Controllers\Logistica'], function ($routes) {
|
||||
|
||||
$routes->get('otList', 'EtiquetasTitulosController::findOTs');
|
||||
$routes->get('addList', 'EtiquetasTitulosController::findAddresses');
|
||||
$routes->post('newEtiquetaTitulos', 'EtiquetasTitulosController::addEtiqueta');
|
||||
$routes->get('datatable', 'EtiquetasTitulosController::datatable');
|
||||
$routes->post('delete', 'EtiquetasTitulosController::deleteEtiqueta');
|
||||
$routes->get('edit/(:num)', 'EtiquetasTitulosController::edit/$1');
|
||||
$routes->get('datatableLineas/(:num)', 'EtiquetasTitulosController::datatableLineasEtiquetas/$1');
|
||||
$routes->get('findOts', 'EtiquetasTitulosController::findOtsWithAddress');
|
||||
$routes->post('addLineas', 'EtiquetasTitulosController::addLineasEtiqueta');
|
||||
$routes->post('deleteLineas', 'EtiquetasTitulosController::deleteLineasEtiqueta');
|
||||
$routes->post('updateLineas', 'EtiquetasTitulosController::updateLineasEtiqueta');
|
||||
$routes->post('updateComentarios', 'EtiquetasTitulosController::updateComentarios');
|
||||
$routes->post('updateOrdenCajas', 'EtiquetasTitulosController::updateOrdenCajas');
|
||||
$routes->post('renumber', 'EtiquetasTitulosController::renumberCajas');
|
||||
$routes->post('imprimirEtiquetas', 'EtiquetasTitulosController::imprimirEtiquetas');
|
||||
});
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Translation
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
$routes->group('translate', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||
$routes->post('getTranslation', 'Language::getTranslation', ['as' => 'getKeys']);
|
||||
});
|
||||
$routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' => 'Language', 'except' => '']);
|
||||
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Additional Routing
|
||||
|
||||
27
ci4/app/Config/Routes/ApiRoutes.php
Executable file
27
ci4/app/Config/Routes/ApiRoutes.php
Executable file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* APIs Route Definitions
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$routes->post('auth/jwt', '\App\Controllers\Sistema\AuthAPIController::jwtLogin');
|
||||
|
||||
$routes->group(
|
||||
'api',
|
||||
[
|
||||
'namespace' => 'App\Controllers\API',
|
||||
'filter' => 'jwt'
|
||||
],
|
||||
static function ($routes) {
|
||||
|
||||
$routes->post("calcular", 'ImprimelibrosApi::calcular');
|
||||
$routes->post("guardar", 'ImprimelibrosApi::guardar');
|
||||
// ...
|
||||
}
|
||||
);
|
||||
30
ci4/app/Config/Routes/CatalogoRoutes.php
Normal file
30
ci4/app/Config/Routes/CatalogoRoutes.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
/* Rutas para tarifas */
|
||||
$routes->group('catalogo', ['namespace' => 'App\Controllers\Catalogo'], function ($routes) {
|
||||
/* Libros */
|
||||
$routes->group('libros', ['namespace' => 'App\Controllers\Catalogo'], function ($routes) {
|
||||
/**======================
|
||||
* CRUD
|
||||
*========================**/
|
||||
$routes->get('', 'CatalogoLibros::index', ['as' => 'catalogoLibrosList']);
|
||||
$routes->get('gettarifas', 'CatalogoLibros::getSelect2');
|
||||
$routes->match(['get', 'post'], 'add', 'CatalogoLibros::add', ['as' => 'catalogoLibrosAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'CatalogoLibros::edit/$1', ['as' => 'catalogoLibrosEdit']);
|
||||
$routes->get('delete/(:num)', 'CatalogoLibros::delete/$1', ['as' => 'catalogoLibrosDelete']);
|
||||
$routes->get('datatable', 'CatalogoLibros::datatable', ['as' => 'catalogoLibrosDT']);
|
||||
|
||||
|
||||
/**======================
|
||||
* AJAX
|
||||
*========================**/
|
||||
$routes->get('clientlist', 'CatalogoLibros::getClientList', ['as' => 'catalogoLibrosClientList']);
|
||||
$routes->get('pedidosAntiguos', 'CatalogoLibros::datatablePedidosAntiguos', ['as' => 'catalogoLibrosPedidosAntiguosDT']);
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
28
ci4/app/Config/Routes/ComprasRoutes.php
Executable file
28
ci4/app/Config/Routes/ComprasRoutes.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
|
||||
/* Compras */
|
||||
$routes->group('compras', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
|
||||
$routes->group('proveedores', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
|
||||
$routes->get('', 'Proveedores::index', ['as' => 'proveedorList']);
|
||||
$routes->get('add', 'Proveedores::add', ['as' => 'newProveedor']);
|
||||
$routes->post('add', 'Proveedores::add', ['as' => 'createProveedor']);
|
||||
$routes->post('create', 'Proveedores::create', ['as' => 'ajaxCreateProveedor']);
|
||||
$routes->put('(:num)/update', 'Proveedores::update/$1', ['as' => 'ajaxUpdateProveedor']);
|
||||
$routes->get('edit/(:num)', 'Proveedores::edit/$1', ['as' => 'editProveedor']);
|
||||
$routes->post('edit/(:num)', 'Proveedores::edit/$1', ['as' => 'updateProveedor']);
|
||||
$routes->post('datatable', 'Proveedores::datatable', ['as' => 'dataTableOfProveedores']);
|
||||
$routes->get('delete/(:num)', 'Proveedores::delete/$1', ['as' => 'deleteProveedores']);
|
||||
$routes->post('allmenuitems', 'Proveedores::allItemsSelect', ['as' => 'select2ItemsOfProveedores']);
|
||||
$routes->post('menuitems', 'Proveedores::menuItems', ['as' => 'menuItemsOfProveedores']);
|
||||
$routes->get('getProveedores', 'Proveedores::getForSelect');
|
||||
});
|
||||
});
|
||||
|
||||
$routes->group('proveedorestipos', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
|
||||
$routes->post('menuitems', 'ProveedoresTipos::menuItems', ['as' => 'menuItemsOfProveedoresTipos']);
|
||||
});
|
||||
162
ci4/app/Config/Routes/ConfiguracionRoutes.php
Executable file
162
ci4/app/Config/Routes/ConfiguracionRoutes.php
Executable file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
/* Rutas para configuraciones */
|
||||
$routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
|
||||
/* Paises */
|
||||
$routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Paises::index', ['as' => 'paisList']);
|
||||
$routes->get('add', 'Paises::add', ['as' => 'newPais']);
|
||||
$routes->post('add', 'Paises::add', ['as' => 'createPais']);
|
||||
$routes->get('delete/(:num)', 'Paises::delete/$1');
|
||||
$routes->post('create', 'Paises::create', ['as' => 'ajaxCreatePais']);
|
||||
$routes->put('update/(:num)', 'Paises::update/$1', ['as' => 'ajaxUpdatePais']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'Paises::edit/$1', ['as' => 'updatePais']);
|
||||
$routes->get('datatable', 'Paises::datatable', ['as' => 'dataTableOfPaises']);
|
||||
$routes->post('allmenuitems', 'Paises::allItemsSelect', ['as' => 'select2ItemsOfPaises']);
|
||||
$routes->post('menuitems', 'Paises::menuItems', ['as' => 'menuItemsOfPaises']);
|
||||
$routes->get('menuitems2', 'Paises::menuItems2', ['as' => 'menuItemsOfPaises2']);
|
||||
});
|
||||
|
||||
|
||||
/* Papeles genericos */
|
||||
$routes->group('papelesgenericos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Papelesgenericos::index', ['as' => 'papelGenericoList']);
|
||||
$routes->delete('', 'Papelesgenericos::index', ['as' => 'papelGenericoList2']);
|
||||
$routes->get('add', 'Papelesgenericos::add', ['as' => 'newPapelGenerico']);
|
||||
$routes->post('add', 'Papelesgenericos::add', ['as' => 'createPapelGenerico']);
|
||||
$routes->post('create', 'Papelesgenericos::create', ['as' => 'ajaxCreatePapelGenerico']);
|
||||
$routes->put('(:num)/update', 'Papelesgenericos::update/$1', ['as' => 'ajaxUpdatePapelGenerico']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'Papelesgenericos::edit/$1', ['as' => 'updatePapelGenerico']);
|
||||
$routes->post('datatable', 'Papelesgenericos::datatable', ['as' => 'dataTableOfPapelesGenericos']);
|
||||
$routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
$routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
|
||||
$routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
|
||||
});
|
||||
|
||||
/* Papeles impresion */
|
||||
$routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Papelesimpresion::index', ['as' => 'papelImpresionList']);
|
||||
$routes->get('add', 'Papelesimpresion::add', ['as' => 'newPapelImpresion']);
|
||||
$routes->post('add', 'Papelesimpresion::add', ['as' => 'createPapelImpresion']);
|
||||
$routes->post('create', 'Papelesimpresion::create', ['as' => 'ajaxCreatePapelImpresion']);
|
||||
$routes->put('(:num)/update', 'Papelesimpresion::update/$1', ['as' => 'ajaxUpdatePapelImpresion']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'Papelesimpresion::edit/$1', ['as' => 'updatePapelImpresion']);
|
||||
$routes->post('datatable', 'Papelesimpresion::datatable', ['as' => 'dataTableOfPapelesImpresion']);
|
||||
$routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']);
|
||||
$routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']);
|
||||
$routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
|
||||
$routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']);
|
||||
$routes->get('show/(:num)', 'Papelesimpresion::papel_impresion_find/$1', ['as' => 'showPapelImpresion']);
|
||||
});
|
||||
|
||||
/* Maquinas */
|
||||
$routes->group('maquinas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Maquinas::index', ['as' => 'maquinaList']);
|
||||
$routes->get('add', 'Maquinas::add', ['as' => 'newMaquina']);
|
||||
$routes->get('edit/(:num)', 'Maquinas::edit/$1');
|
||||
$routes->get('delete/(:num)', 'Maquinas::delete/$1');
|
||||
$routes->post('add', 'Maquinas::add', ['as' => 'createMaquina']);
|
||||
$routes->post('create', 'Maquinas::create', ['as' => 'ajaxCreateMaquina']);
|
||||
$routes->put('update/(:num)', 'Maquinas::update/$1', ['as' => 'ajaxUpdateMaquina']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'Maquinas::edit/$1', ['as' => 'updateMaquina']);
|
||||
$routes->post('datatable', 'Maquinas::datatable', ['as' => 'dataTableOfMaquinas']);
|
||||
$routes->post('allmenuitems', 'Maquinas::allItemsSelect', ['as' => 'select2ItemsOfMaquinas']);
|
||||
$routes->post('menuitems', 'Maquinas::menuItems', ['as' => 'menuItemsOfMaquinas']);
|
||||
$routes->post('duplicate/(:num)', 'Maquinas::duplicate/$1', ['as' => 'duplicateMaquina']);
|
||||
$routes->get('(:num)', 'Maquinas::find_maquina/$1', ['as' => 'findMaquina']);
|
||||
$routes->get('select', 'Maquinas::select', ['as' => 'selectMaquinas']);
|
||||
});
|
||||
|
||||
/* Maquinas por defecto */
|
||||
$routes->group('maquinasdefecto', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Maquinasdefecto::index', ['as' => 'maquinaPorDefectoList']);
|
||||
$routes->get('add', 'Maquinasdefecto::add', ['as' => 'newMaquinaPorDefecto']);
|
||||
$routes->post('add', 'Maquinasdefecto::add', ['as' => 'createMaquinaPorDefecto']);
|
||||
$routes->post('create', 'Maquinasdefecto::create', ['as' => 'ajaxCreateMaquinaPorDefecto']);
|
||||
$routes->put('(:num)/update', 'Maquinasdefecto::update/$1', ['as' => 'ajaxUpdateMaquinaPorDefecto']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'Maquinasdefecto::edit/$1', ['as' => 'updateMaquinaPorDefecto']);
|
||||
$routes->post('datatable', 'Maquinasdefecto::datatable', ['as' => 'dataTableOfMaquinasPorDefecto']);
|
||||
$routes->post('allmenuitems', 'Maquinasdefecto::allItemsSelect', ['as' => 'select2ItemsOfMaquinasPorDefecto']);
|
||||
$routes->post('menuitems', 'Maquinasdefecto::menuItems', ['as' => 'menuItemsOfMaquinasPorDefecto']);
|
||||
});
|
||||
|
||||
|
||||
/* Ubicaciones */
|
||||
$routes->group('ubicaciones', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
|
||||
$routes->get('', 'Ubicaciones::index', ['as' => 'ubicacionesList']);
|
||||
$routes->match(['get', 'post'], 'add', 'Ubicaciones::add', ['as' => 'ubicacionesAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'Ubicaciones::edit/$1', ['as' => 'ubicacionesEdit']);
|
||||
$routes->get('delete/(:num)', 'Ubicaciones::delete/$1', ['as' => 'ubicacionesDelete']);
|
||||
$routes->post('datatable', 'Ubicaciones::datatable', ['as' => 'ubicacionesDT']);
|
||||
});
|
||||
|
||||
/* Permisos y roles */
|
||||
$routes->group('group', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Group::index', ['as' => 'userGroupList']);
|
||||
$routes->get('index', 'Group::index', ['as' => 'groupIndex']);
|
||||
$routes->post('edit/(:num)', 'Group::edit/$1', ['as' => 'updateGroup']);
|
||||
$routes->get('edit/(:num)', 'Group::edit/$1', ['as' => 'editGroup']);
|
||||
$routes->get('delete/(:num)', 'Group::delete/$1', ['as' => 'deleteGroup']);
|
||||
$routes->get('add', 'Group::add', ['as' => 'newGroup']);
|
||||
$routes->post('add', 'Group::add', ['as' => 'createGroup']);
|
||||
});
|
||||
|
||||
/* Series Factura */
|
||||
$routes->group('series-facturas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'SeriesFacturas::index', ['as' => 'seriesFacturasList']);
|
||||
$routes->match(['get', 'post'], 'add', 'SeriesFacturas::add', ['as' => 'seriesFacturasAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'SeriesFacturas::edit/$1', ['as' => 'seriesFacturasEdit']);
|
||||
$routes->get('delete/(:num)', 'SeriesFacturas::delete/$1', ['as' => 'seriesFacturasDelete']);
|
||||
$routes->post('datatable', 'SeriesFacturas::datatable', ['as' => 'seriesFacturasDT']);
|
||||
$routes->post('menuitemsFacturas', 'SeriesFacturas::menuItemsFacturas', ['as' => 'menuItemsOfSeriesFacturas']);
|
||||
});
|
||||
|
||||
/* Variables del sistema */
|
||||
$routes->group("variables", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
|
||||
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
|
||||
$routes->post('edit/(:num)', 'ConfigVariables::updateVariable/$1', ['as' => 'updateVariable']);
|
||||
$routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']);
|
||||
$routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']);
|
||||
});
|
||||
|
||||
/* Errores en presupuestos */
|
||||
$routes->group("errores-presupuesto", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'ConfigErrores::index', ['as' => 'erroresPresupuestoIndex']);
|
||||
$routes->get('edit/(:num)', 'ConfigErrores::viewForm/$1', ['as' => 'erroresPresupuestoViewForm']);
|
||||
$routes->get('get/(:num)', 'ConfigErrores::get_error_presupuesto/$1', ['as' => 'erroresPresupuestoGetErrorPresupuesto']);
|
||||
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
|
||||
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
|
||||
});
|
||||
|
||||
$routes->group("maquina-tareas", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'MaquinaTarea::index', ['as' => 'maquinaTareaList']);
|
||||
$routes->get('(:num)', 'MaquinaTarea::show/$1', ['as' => 'maquinaTareaShow']);
|
||||
$routes->delete('(:num)', 'MaquinaTarea::delete/$1', ['as' => 'maquinaTareaDelete']);
|
||||
$routes->post('', 'MaquinaTarea::store/$1', ['as' => 'maquinaTareaStore']);
|
||||
$routes->post('update/(:num)', 'MaquinaTarea::update_servicio_cliente/$1', ['as' => 'maquinaTareaUpdate']);
|
||||
$routes->get('edit/(:num)', 'MaquinaTarea::viewForm/$1', ['as' => 'maquinaTareaViewForm']);
|
||||
$routes->get('datatable', 'MaquinaTarea::datatable', ['as' => 'maquinaTareaDatatable']);
|
||||
});
|
||||
$routes->group("messages", ["namespace" => 'App\Controllers\Chat'], function ($routes) {
|
||||
$routes->get('', 'ChatController::config_view', ['as' => 'configMessagesIndex']);
|
||||
});
|
||||
|
||||
|
||||
/* Festivos */
|
||||
$routes->group("festivos", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'FestivoController::index', ['as' => 'festivosList']);
|
||||
$routes->post('', 'FestivoController::store_festivo_date', ['as' => 'storeFestivoDate']);
|
||||
$routes->delete('(:num)', 'FestivoController::delete_festivo_date/$1', ['as' => 'deleteFestivoDate']);
|
||||
$routes->get('all', 'FestivoController::find_all', ['as' => 'getFindAllFestivos']);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
39
ci4/app/Config/Routes/ImportadoresRoutes.php
Normal file
39
ci4/app/Config/Routes/ImportadoresRoutes.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
/* Rutas para tarifas */
|
||||
$routes->group('importador', ['namespace' => 'App\Controllers\Importadores'], function ($routes) {
|
||||
|
||||
/* Desde Catalogo */
|
||||
$routes->group('catalogo', ['namespace' => 'App\Controllers\Importadores'], function ($routes) {
|
||||
/**======================
|
||||
* Tool
|
||||
*========================**/
|
||||
$routes->get('', 'ImportadorCatalogo::index', ['as' => 'importadorCatalogoTool']);
|
||||
|
||||
/**======================
|
||||
* AJAX
|
||||
*========================**/
|
||||
$routes->post('validar-fila', 'ImportadorCatalogo::validarFila');
|
||||
$routes->post('importar-fila', 'ImportadorCatalogo::importarFila');
|
||||
|
||||
});
|
||||
|
||||
/* Desde Cliente Bubok */
|
||||
$routes->group('bubok', ['namespace' => 'App\Controllers\Importadores'], function ($routes) {
|
||||
/**======================
|
||||
* Tool
|
||||
*========================**/
|
||||
$routes->get('', 'ImportadorBubok::index', ['as' => 'importadorBubokTool']);
|
||||
|
||||
/**======================
|
||||
* AJAX
|
||||
*========================**/
|
||||
$routes->post('validar-fila', 'ImportadorBubok::validarFila');
|
||||
$routes->post('importar-fila', 'ImportadorBubok::importarFila');
|
||||
|
||||
});
|
||||
});
|
||||
70
ci4/app/Config/Routes/PresupuestosRoutes.php
Executable file
70
ci4/app/Config/Routes/PresupuestosRoutes.php
Executable file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
$routes->group('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('list/(:num)', 'Presupuestoadmin::list/$1', ['as' => 'presupuestoAdminList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'newPresupuestoAdmin']);
|
||||
$routes->get('edit/(:any)', 'Presupuestoadmin::edit/$1', ['as' => 'editarPresupuestoAdmin']);
|
||||
$routes->post('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'createPresupuestoAdmin']);
|
||||
$routes->post('create', 'Presupuestoadmin::create', ['as' => 'ajaxCreatePresupuestoAdmin']);
|
||||
$routes->put('(:num)/update', 'Presupuestoadmin::update/$1', ['as' => 'ajaxUpdatePresupuestoAdmin']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoadmin::edit/$1', ['as' => 'updatePresupuestoAdmin']);
|
||||
$routes->post('datatable', 'Presupuestoadmin::datatable', ['as' => 'dataTableOfPresupuestoAdmin']);
|
||||
$routes->post('datatable_2', 'Presupuestoadmin::datatable_2', ['as' => 'updateDataOfPresupuestoAdmin']);
|
||||
$routes->post('allmenuitems', 'Presupuestoadmin::allItemsSelect', ['as' => 'select2ItemsOfPresupuestoAdmin']);
|
||||
$routes->post('menuitems', 'Presupuestoadmin::menuItems', ['as' => 'menuItemsOfPresupuestoAdmin']);
|
||||
|
||||
$routes->get('cargar/(:any)', 'Presupuestoadmin::cargar/$1');
|
||||
$routes->post('comparadorinterior', 'Presupuestoadmin::obtenerComparadorInterior');
|
||||
$routes->post('comparadorexteriores', 'Presupuestoadmin::obtenerComparadorExteriores');
|
||||
$routes->post('comparadorguardas', 'Presupuestoadmin::obtenerComparadorGuardas');
|
||||
$routes->get('papelgenerico', 'Presupuestoadmin::getPapelGenerico');
|
||||
$routes->get('papelgramaje', 'Presupuestoadmin::getGramaje');
|
||||
$routes->get('papelimpresion', 'Presupuestoadmin::getPapelImpresion');
|
||||
$routes->get('maquinas', 'Presupuestoadmin::getMaquinas');
|
||||
$routes->post('getlinea', 'Presupuestoadmin::getLineaPresupuesto');
|
||||
$routes->post('clone', 'Presupuestoadmin::datatable_2');
|
||||
|
||||
$routes->get('presupuestosCliente', 'Presupuestoadmin::tablaClienteForm');
|
||||
$routes->get('getSumCliente/(:num)', 'Presupuestoadmin::obtenerTotalPresupuestosCliente/$1');
|
||||
|
||||
$routes->get('hasFiles', 'Presupuestoadmin::hasFiles');
|
||||
$routes->post('reprint', 'Presupuestoadmin::reprintPresupuesto');
|
||||
|
||||
$routes->post('download_zip', 'Presupuestocliente::download_zip', ['as' => 'descargarAdminArchivos']);
|
||||
});
|
||||
|
||||
//$routes->resource('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestoadmin', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('list', 'Presupuestocliente::list', ['as' => 'listaPresupuestos']);
|
||||
$routes->post('datatable', 'Presupuestocliente::datatable', ['as' => 'datatableOfPresupuestos']);
|
||||
$routes->get('add', 'Presupuestocliente::add', ['as' => 'nuevoPresupuestoCliente']);
|
||||
$routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']);
|
||||
$routes->post('edit/(:num)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente']);
|
||||
$routes->get('edit/(:any)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente2']);
|
||||
$routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']);
|
||||
$routes->post('presupuesto', 'Presupuestocliente::presupuesto', ['as' => 'presupuestoCliente']);
|
||||
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
|
||||
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
|
||||
$routes->post('guardar', 'Presupuestocliente::guardar', ['as' => 'guardar']);
|
||||
$routes->get('cargar/(:num)', 'Presupuestocliente::cargar/$1', ['as' => 'cargarPresupuesto']);
|
||||
$routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']);
|
||||
$routes->post('calcular', 'Presupuestocliente::calcular', ['as' => 'calcularPresupuesto']);
|
||||
$routes->post('calcularsolapas', 'Presupuestocliente::calcularMaxSolapas', ['as' => 'calcularSolapas']);
|
||||
$routes->post('checklomo', 'Presupuestocliente::check_lomo_interior');
|
||||
$routes->post('download_zip', 'Presupuestocliente::download_zip', ['as' => 'descargarClienteArchivos']);
|
||||
});
|
||||
//$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('importador', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('', 'Importadorpresupuestos::index', ['as' => 'importadorPresupuestos']);
|
||||
$routes->get('clientlist', 'Importadorpresupuestos::getClientList', ['as' => 'clientList']);
|
||||
$routes->get('presupuestoslist', 'Importadorpresupuestos::getPresupuestosList', ['as' => 'presupuestosList']);
|
||||
$routes->get('getencuadernacion', 'Importadorpresupuestos::getEncuadernacionList');
|
||||
$routes->get('getpresupuestodata', 'Importadorpresupuestos::getPresupuesto', ['as' => 'getPresupuesto']);
|
||||
$routes->post('importar', 'Importadorpresupuestos::importarPresupuesto');
|
||||
});
|
||||
13
ci4/app/Config/Routes/ScriptsRoutes.php
Normal file
13
ci4/app/Config/Routes/ScriptsRoutes.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
/* Rutas para tarifas */
|
||||
$routes->group('scripts', ['namespace' => 'App\Controllers\Scripts'], function ($routes) {
|
||||
|
||||
//$routes->get('completar-identidades', 'UsersIntegrity::completarIdentidades');
|
||||
|
||||
|
||||
});
|
||||
55
ci4/app/Config/Routes/TarifasRoutes.php
Executable file
55
ci4/app/Config/Routes/TarifasRoutes.php
Executable file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/** @var RouteCollection $routes */
|
||||
|
||||
/* Rutas para tarifas */
|
||||
$routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
|
||||
/* Maquinas */
|
||||
$routes->group('maquinas', ['namespace' => 'App\Controllers\Tarifas\Maquinas'], function ($routes) {
|
||||
|
||||
$routes->post('acabado', 'TarifaMaquinas::add_tarifa_acabado_maquina_with_tarea');
|
||||
$routes->post('manipulado', 'TarifaMaquinas::add_tarifa_manipulado_maquina_with_tarea');
|
||||
$routes->post('preimpresion', 'TarifaMaquinas::add_tarifa_preimpresion_maquina_with_tarea');
|
||||
$routes->post('encuadernacion', 'TarifaMaquinas::add_tarifa_encuadernacion_maquina_with_tarea');
|
||||
$routes->post('extra', 'TarifaMaquinas::add_tarifa_extra_maquina_with_tarea');
|
||||
|
||||
|
||||
$routes->delete('acabado/(:num)', 'TarifaMaquinas::delete_tarifa_acabado_maquina_with_tarea/$1');
|
||||
$routes->delete('manipulado/(:num)', 'TarifaMaquinas::delete_tarifa_manipulado_maquina_with_tarea/$1');
|
||||
$routes->delete('preimpresion/(:num)', 'TarifaMaquinas::delete_tarifa_preimpresion_maquina_with_tarea/$1');
|
||||
$routes->delete('encuadernacion/(:num)', 'TarifaMaquinas::delete_tarifa_encuadernacion_maquina_with_tarea/$1');
|
||||
$routes->delete('extra/(:num)', 'TarifaMaquinas::delete_tarifa_extra_maquina_with_tarea/$1');
|
||||
|
||||
$routes->get('acabado/select', 'TarifaMaquinas::get_select_maquina_acabado');
|
||||
$routes->get('manipulado/select', 'TarifaMaquinas::get_select_maquina_manipulado');
|
||||
$routes->get('impresion/select', 'TarifaMaquinas::get_select_maquina_impresion');
|
||||
$routes->get('encuadernacion/select', 'TarifaMaquinas::get_select_maquina_manipulado');
|
||||
$routes->get('tareas/select', 'TarifaMaquinas::get_select_maquina_tareas');
|
||||
|
||||
$routes->get('acabado/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_acabado_maquina/$1');
|
||||
$routes->get('manipulado/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_manipulado_maquina/$1');
|
||||
$routes->get('preimpresion/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_preimpresion_maquina/$1');
|
||||
$routes->get('encuadernacion/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_encuadernacion_maquina/$1');
|
||||
$routes->get('extra/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_extra_maquina/$1');
|
||||
});
|
||||
|
||||
/* Acabados */
|
||||
$routes->group('acabados', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
|
||||
$routes->get('', 'TarifaAcabados::index', ['as' => 'tarifaAcabadoList']);
|
||||
$routes->get('gettarifas', 'TarifaAcabados::getSelect2');
|
||||
$routes->match(['get', 'post'], 'add', 'TarifaAcabados::add', ['as' => 'tarifaAcabadoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
|
||||
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
|
||||
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);
|
||||
$routes->get('select', 'TarifaAcabados::show_select', ["as" => "showSelectTarifaAcabado"]);
|
||||
$routes->group('lineas', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
$routes->post('datatable', 'TarifaAcabadosLineas::datatable', ['as' => 'tarifaAcabadoLineasDT']);
|
||||
$routes->post('datatable_editor', 'TarifaAcabadosLineas::datatable_editor', ['as' => 'tarifaAcabadoLineasDTE']);
|
||||
$routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
|
||||
});
|
||||
});
|
||||
});
|
||||
3
ci4/app/Config/Routing.php
Normal file → Executable file
3
ci4/app/Config/Routing.php
Normal file → Executable file
@ -27,6 +27,7 @@ class Routing extends BaseRouting
|
||||
*/
|
||||
public array $routeFiles = [
|
||||
APPPATH . 'Config/Routes.php',
|
||||
APPPATH . 'Config/Wiki/WikiRoutes.php',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -95,7 +96,7 @@ class Routing extends BaseRouting
|
||||
*
|
||||
* Default: false
|
||||
*/
|
||||
public bool $prioritize = false;
|
||||
public bool $prioritize = true;
|
||||
|
||||
/**
|
||||
* Map of URI segments and namespaces. For Auto Routing (Improved).
|
||||
|
||||
0
ci4/app/Config/Safekat.php
Normal file → Executable file
0
ci4/app/Config/Safekat.php
Normal file → Executable file
@ -2,7 +2,16 @@
|
||||
|
||||
namespace Config;
|
||||
|
||||
use App\Services\ChatService;
|
||||
use App\Services\FTPService;
|
||||
use App\Services\ImpresoraEtiquetaService;
|
||||
use App\Services\MaquinaService;
|
||||
use App\Services\MessageService;
|
||||
use App\Services\PapelImpresionService;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Services\ProductionService;
|
||||
use App\Services\TarifaMaquinaService;
|
||||
use CodeIgniter\Email\Email;
|
||||
|
||||
/**
|
||||
* Services Configuration file.
|
||||
@ -29,4 +38,40 @@ class Services extends BaseService
|
||||
* return new \CodeIgniter\Example();
|
||||
* }
|
||||
*/
|
||||
|
||||
public static function production(){
|
||||
return new ProductionService();
|
||||
}
|
||||
public static function tarifa_maquina(){
|
||||
return new TarifaMaquinaService();
|
||||
}
|
||||
public static function papel_impresion()
|
||||
{
|
||||
return new PapelImpresionService();
|
||||
}
|
||||
public static function maquina()
|
||||
{
|
||||
return new MaquinaService();
|
||||
}
|
||||
public static function messages()
|
||||
{
|
||||
return new MessageService();
|
||||
}
|
||||
public static function chat()
|
||||
{
|
||||
return new ChatService();
|
||||
}
|
||||
public static function impresora_etiqueta()
|
||||
{
|
||||
return new ImpresoraEtiquetaService();
|
||||
}
|
||||
public static function emailService($getShared = true)
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance('emailService');
|
||||
}
|
||||
|
||||
return new \App\Services\EmailService();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
0
ci4/app/Config/Session.php
Normal file → Executable file
0
ci4/app/Config/Session.php
Normal file → Executable file
0
ci4/app/Config/Toolbar.php
Normal file → Executable file
0
ci4/app/Config/Toolbar.php
Normal file → Executable file
@ -34,7 +34,7 @@ class Validation extends BaseConfig
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $templates = [
|
||||
'list' => 'CodeIgniter\Validation\Views\list',
|
||||
'list' => 'CodeIgniter\Validation\Views\list',
|
||||
'single' => 'CodeIgniter\Validation\Views\single',
|
||||
'bootstrap_style' => 'themes/_commonPartialsBs/_form_validation_errors',
|
||||
];
|
||||
@ -42,4 +42,195 @@ class Validation extends BaseConfig
|
||||
// --------------------------------------------------------------------
|
||||
// Rules
|
||||
// --------------------------------------------------------------------
|
||||
/**
|
||||
* Maquina duplicate validation
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public array $maquina_duplicate = [
|
||||
"name" => "required|string"
|
||||
];
|
||||
/**
|
||||
* PapelImpresion duplicate validation
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public array $papel_impresion_duplicate = [
|
||||
"name" => "required|string"
|
||||
];
|
||||
/**========================================================================
|
||||
* TARIFA MAQUINA ACABADO
|
||||
*========================================================================**/
|
||||
public array $tarifa_maquina_acabado =
|
||||
[
|
||||
"tarifa_acabado_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_manipulado =
|
||||
[
|
||||
"tarifa_manipulado_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_preimpresion =
|
||||
[
|
||||
"tarifa_preimpresion_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_encuadernacion =
|
||||
[
|
||||
"tarifa_encuadernacion_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
public array $tarifa_maquina_extra =
|
||||
[
|
||||
"tarifa_extra_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "maquina",
|
||||
],
|
||||
"maquina_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea",
|
||||
],
|
||||
];
|
||||
|
||||
public array $orden_trabajo_tarea = [
|
||||
|
||||
"orden_trabajo_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea"
|
||||
],
|
||||
// "tiempo_real" => [
|
||||
// "rules" => "required|float",
|
||||
// "label" => "tiempo real"
|
||||
// ]
|
||||
];
|
||||
public array $orden_trabajo_date = [
|
||||
"orden_trabajo_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea"
|
||||
],
|
||||
|
||||
];
|
||||
public array $orden_trabajo_tarea_progress_date = [
|
||||
|
||||
"ot_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "tarea"
|
||||
],
|
||||
"estado" => [
|
||||
"rules" => "required|in_list[P,I,S,D,F,E]",
|
||||
"label" => "estado"
|
||||
]
|
||||
];
|
||||
public array $orden_trabajo = [
|
||||
"orden_trabajo_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Orden trabajo"
|
||||
],
|
||||
|
||||
];
|
||||
public array $orden_trabajo_fichaje_auto = [
|
||||
"orden_trabajo_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Orden trabajo"
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Máquina"
|
||||
],
|
||||
"estado" => [
|
||||
"rules" => "required|in_list[P,I,S,D,F,E]",
|
||||
"label" => "estado"
|
||||
],
|
||||
"tareas" => [
|
||||
"rules" => "required",
|
||||
"label" => "Tareas"
|
||||
],
|
||||
"click_init" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Click init"
|
||||
],
|
||||
"click_end" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Click end"
|
||||
],
|
||||
|
||||
];
|
||||
public array $maquina_ordenes_trabajo = [
|
||||
"ordenes_trabajo" => [
|
||||
"rules" => "required",
|
||||
"label" => "Orden trabajo"
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Máquina"
|
||||
],
|
||||
|
||||
];
|
||||
public array $chat_department =
|
||||
[
|
||||
"display" => [
|
||||
"rules" => "required|string",
|
||||
"label" => "tarifa acabado",
|
||||
],
|
||||
"description" => [
|
||||
"rules" => "permit_empty",
|
||||
"label" => "maquina",
|
||||
],
|
||||
];
|
||||
public array $proveedor_tarea =
|
||||
[
|
||||
"proveedor_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Proveedor",
|
||||
],
|
||||
"orden_trabajo_tarea_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Tarea",
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
20
ci4/app/Config/Wiki/WikiRoutes.php
Executable file
20
ci4/app/Config/Wiki/WikiRoutes.php
Executable file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
|
||||
$routes->group('wiki', ['namespace' => 'App\Controllers\Wiki'], function ($routes) {
|
||||
$routes->get('','WikiController::index',["as" => "wikiIndex"]);
|
||||
$routes->get('view/(:segment)','WikiController::show_page/$1',["as" => "showWikiPage"]);
|
||||
$routes->get('section/(:num)','WikiController::get_section/$1',["as" => "getWikiSection"]);
|
||||
$routes->post('section','WikiController::store_section',["as" => "storeWikiSection"]);
|
||||
$routes->delete('section/(:num)','WikiController::delete_section/$1',["as" => "deleteWikiSection"]);
|
||||
$routes->post('update/section','WikiController::update_section',["as" => "updateWikiSection"]);
|
||||
$routes->post('save/(:num)','WikiController::store_save_page/$1',["as" => "storeWikiSavePage"]);
|
||||
$routes->post('publish/(:num)','WikiController::store_publish_page/$1',["as" => "storeWikiPublishPage"]);
|
||||
$routes->post('file/upload/(:num)','WikiController::wiki_file_upload/$1',["as" => "storeWikiFileUpload"]);
|
||||
$routes->get('file/(:num)','WikiController::get_wiki_file/$1',["as" => "getWikiFile"]);
|
||||
$routes->post('section/update/order','WikiController::wiki_section_update_order',["as" => "updateWikiSectionOrder"]);
|
||||
|
||||
|
||||
});
|
||||
110
ci4/app/Controllers/API/ImprimelibrosApi.php
Executable file
110
ci4/app/Controllers/API/ImprimelibrosApi.php
Executable file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\API;
|
||||
|
||||
use App\Controllers\Presupuestos\Presupuestocliente;
|
||||
use CodeIgniter\RESTful\ResourceController;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class ImprimelibrosApi extends ResourceController
|
||||
{
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
|
||||
public function calcular()
|
||||
{
|
||||
helper(['form']);
|
||||
|
||||
$jsonData = json_decode($this->request->getBody(), true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => 400,
|
||||
'error' => 'Invalid JSON format'
|
||||
],
|
||||
400
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Access the entire POST data
|
||||
$post_data = $jsonData;
|
||||
|
||||
//return $this->respond(var_dump($post_data));
|
||||
|
||||
// Instancia de presupuesto cliente
|
||||
$presupuestocliente = new Presupuestocliente();
|
||||
$response = $presupuestocliente->calcular($post_data);
|
||||
|
||||
if (isset($response['tiradas'])) {
|
||||
|
||||
$response = [
|
||||
'status' => 200,
|
||||
'error' => null,
|
||||
'data' => [
|
||||
'tiradas' => $response['tiradas'],
|
||||
'precios' => $response['precio_u']
|
||||
]
|
||||
];
|
||||
} else {
|
||||
$response = [
|
||||
'status' => 400,
|
||||
'error' => $response
|
||||
];
|
||||
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
|
||||
public function guardar()
|
||||
{
|
||||
helper(['form']);
|
||||
|
||||
// Access the entire POST data
|
||||
$post_data = $this->request->getJSON(true);
|
||||
|
||||
//return $this->respond(var_dump($post_data));
|
||||
|
||||
// Instancia de presupuesto cliente
|
||||
$presupuestocliente = new Presupuestocliente();
|
||||
try {
|
||||
$response = $presupuestocliente->guardar($post_data);
|
||||
|
||||
// DEBUG LINE
|
||||
//return $this->respond($response);
|
||||
|
||||
if (!isset($response['sk_id'])) {
|
||||
return $this->respond([
|
||||
'status' => 400,
|
||||
'error' => 'Missing sk_id',
|
||||
'message' => 'El identificador sk_id es requerido pero no se recibió.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$response = [
|
||||
'status' => 200,
|
||||
'error' => null,
|
||||
'data' => [
|
||||
'sk_id' => $response['sk_id'],
|
||||
'sk_url' => $response['sk_url'] ?? null
|
||||
]
|
||||
];
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $this->respond([
|
||||
'status' => 500,
|
||||
'error' => 'Server error',
|
||||
'message' => 'Error inesperado durante el procesado'
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,507 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\CronTabModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use App\Models\Usuarios\GroupModel;
|
||||
use App\Models\Usuarios\GroupsUsersModel;
|
||||
use App\Models\ActivityModel;
|
||||
use CodeIgniter\RESTful\ResourceController;
|
||||
|
||||
class Ajax extends ResourceController
|
||||
{
|
||||
private $user_model;
|
||||
private $group_model;
|
||||
private $group_user_model;
|
||||
private $activity_model;
|
||||
private $crontab_model;
|
||||
private $notification_model;
|
||||
private $id_user;
|
||||
private $token_user;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->user_model = new UserModel();
|
||||
$this->group_model = new GroupModel();
|
||||
$this->group_user_model = new GroupsUsersModel();
|
||||
$this->activity_model = new ActivityModel();
|
||||
$this->crontab_model = new CronTabModel();
|
||||
$this->notification_model = new NotificationModel();
|
||||
$this->id_user = session()->get('id_user');
|
||||
$this->token_user = session()->get('token');
|
||||
$language = \Config\Services::language();
|
||||
$language->setLocale(session()->lang);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return redirect()->to('/home');
|
||||
}
|
||||
|
||||
public function getUsers(){
|
||||
$postData = service('request')->getVar();
|
||||
if($postData != null && isset($postData->data)){
|
||||
$dtpostData = $postData->data;
|
||||
|
||||
//Read value
|
||||
$draw = $dtpostData->draw;
|
||||
$start = $dtpostData->start;
|
||||
$rowperpage = $dtpostData->length; // Rows display per page
|
||||
$columnIndex = $dtpostData->order[0]->column; // Column index
|
||||
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
|
||||
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
|
||||
$searchValue = $dtpostData->search->value; // Search value
|
||||
|
||||
//Total number of records without filtering
|
||||
$totalRecords = $this->user_model->select('id_user')
|
||||
//->join('auth_groups','auth_groups.token = auth_user.group')
|
||||
->countAllResults();
|
||||
|
||||
//Total number of records with filtering
|
||||
$totalRecordwithFilter = $this->user_model->select('id_user')
|
||||
//->join('auth_groups','auth_groups.token = auth_user.group')
|
||||
->orLike('first_name', $searchValue)
|
||||
->orLike('email', $searchValue)
|
||||
->countAllResults();
|
||||
|
||||
//Fetch records
|
||||
//$records = $this->user_model->select('auth_user.*,auth_groups.title')
|
||||
$records = $this->user_model->select('auth_user.*')
|
||||
//->join('auth_groups','auth_groups.token = auth_user.group')
|
||||
->orLike('first_name', $searchValue)
|
||||
->orLike('email', $searchValue)
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
|
||||
|
||||
|
||||
//Format records
|
||||
foreach ($records as $key => $value){
|
||||
if($records[$key]['email_confirmed'] == 1){
|
||||
$records[$key]['email'] = $records[$key]['email'].' '.'<span class="text-success"><i class="fas fa-check-circle"></i></span>';
|
||||
}
|
||||
$editLink = site_url('usuarios/user/edit/').$records[$key]['token'];
|
||||
$records[$key]['options'] = ''.
|
||||
'<div class="btn-group mr-1 mb-1" xmlns="http://www.w3.org/1999/html">
|
||||
<button type="button" class="btn btn-primary btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
'.lang("App.user_grid_options").'
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="'.$editLink.'"><i class="fas fa-edit"></i> '.lang("App.user_btn_edit").'</a>
|
||||
<button type="button" class="dropdown-item" onclick="delete_user(\''.$records[$key]['token'].'\');"><i class="fas fa-trash"></i> '.lang("App.user_btn_delete").'</button>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
//Data records
|
||||
$data = array();
|
||||
foreach($records as $record ){
|
||||
|
||||
$groups_token = $this->group_user_model->select('token_group')
|
||||
->where('token_user',$record['token'])
|
||||
->findAll();
|
||||
|
||||
$groups_names = [];
|
||||
foreach($groups_token as $g_t){
|
||||
$title = $this->group_model->select('title')
|
||||
->where('token',$g_t)
|
||||
->first()['title'];
|
||||
array_push($groups_names, $title);
|
||||
|
||||
}
|
||||
|
||||
$data[] = array(
|
||||
"first_name"=>$record['first_name'],
|
||||
"email"=>$record['email'],
|
||||
|
||||
"group"=>$groups_names,//JJO$record['title'],
|
||||
|
||||
"mobile"=>$record['mobile'],
|
||||
"last_access"=>$record['last_access'],
|
||||
"last_ip"=>$record['last_ip'],
|
||||
"created_at"=>$record['created_at'],
|
||||
"options"=>$record['options']
|
||||
);
|
||||
}
|
||||
|
||||
//Response
|
||||
$response = array(
|
||||
"draw" => intval($draw),
|
||||
"iTotalRecords" => $totalRecords,
|
||||
"iTotalDisplayRecords" => $totalRecordwithFilter,
|
||||
"aaData" => $data,
|
||||
"token" => csrf_hash() // New token hash
|
||||
);
|
||||
return $this->response->setJSON($response);
|
||||
}else{
|
||||
return $this->response->setJSON(["error"=>true]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getGroups(){
|
||||
$postData = service('request')->getVar();
|
||||
if($postData != null && isset($postData->data)){
|
||||
$dtpostData = $postData->data;
|
||||
|
||||
//Read value
|
||||
$draw = $dtpostData->draw;
|
||||
$start = $dtpostData->start;
|
||||
$rowperpage = $dtpostData->length; // Rows display per page
|
||||
$columnIndex = $dtpostData->order[0]->column; // Column index
|
||||
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
|
||||
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
|
||||
$searchValue = $dtpostData->search->value; // Search value
|
||||
|
||||
//Total number of records without filtering
|
||||
$totalRecords = $this->group_model->select('id_group')
|
||||
->countAllResults();
|
||||
|
||||
//Total number of records with filtering
|
||||
$totalRecordwithFilter = $this->group_model->select('id_group')
|
||||
->orLike('title', $searchValue)
|
||||
->countAllResults();
|
||||
|
||||
//Fetch records
|
||||
$records = $this->group_model->select('*')
|
||||
->orLike('title', $searchValue)
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
|
||||
//Format records
|
||||
foreach ($records as $key => $value){
|
||||
$editLink = site_url('usuarios/group/edit/').$records[$key]['token'];
|
||||
$records[$key]['options'] = ''.
|
||||
'<div class="btn-group mr-1 mb-1" xmlns="http://www.w3.org/1999/html">
|
||||
<button type="button" class="btn btn-primary btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
'.lang("App.group_grid_options").'
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="'.$editLink.'"><i class="fas fa-edit"></i> '.lang("App.group_btn_edit").'</a>
|
||||
<button type="button" class="dropdown-item" onclick="delete_group(\''.$records[$key]['token'].'\');"><i class="fas fa-trash"></i> '.lang("App.group_btn_delete").'</button>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
//Data records
|
||||
$data = array();
|
||||
foreach($records as $record ){
|
||||
$data[] = array(
|
||||
"title"=>$record['title'],
|
||||
"dashboard"=>$record['dashboard'],
|
||||
"created_at"=>$record['created_at'],
|
||||
"updated_at"=>$record['updated_at'],
|
||||
"options"=>$record['options']
|
||||
);
|
||||
}
|
||||
|
||||
//Response
|
||||
$response = array(
|
||||
"draw" => intval($draw),
|
||||
"iTotalRecords" => $totalRecords,
|
||||
"iTotalDisplayRecords" => $totalRecordwithFilter,
|
||||
"aaData" => $data,
|
||||
"token" => csrf_hash() // New token hash
|
||||
);
|
||||
return $this->response->setJSON($response);
|
||||
}else{
|
||||
return $this->response->setJSON(["error"=>true]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getActivities($all=""){
|
||||
$postData = service('request')->getVar();
|
||||
if($postData != null && isset($postData->data)){
|
||||
$dtpostData = $postData->data;
|
||||
|
||||
//Read value
|
||||
$draw = $dtpostData->draw;
|
||||
$start = $dtpostData->start;
|
||||
$rowperpage = $dtpostData->length; // Rows display per page
|
||||
$columnIndex = $dtpostData->order[0]->column; // Column index
|
||||
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
|
||||
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
|
||||
$searchValue = $dtpostData->search->value; // Search value
|
||||
|
||||
$session = session();
|
||||
|
||||
//Total number of records without filtering
|
||||
if($session->get('dashboard')=='admin' && !empty($all)){
|
||||
$totalRecords = $this->activity_model->select('id_activity')
|
||||
->join('auth_user','auth_user.token = auth_activity.user')
|
||||
->countAllResults();
|
||||
}else{
|
||||
$totalRecords = $this->activity_model->select('id_activity')
|
||||
->join('auth_user','auth_user.token = auth_activity.user')
|
||||
->where('auth_activity.user',$session->get('token'))
|
||||
->countAllResults();
|
||||
}
|
||||
|
||||
//Total number of records with filtering
|
||||
if($session->get('dashboard')=='admin' && !empty($all)){
|
||||
$totalRecordwithFilter = $this->activity_model->select('id_activity')
|
||||
->join('auth_user','auth_user.token = auth_activity.user')
|
||||
->orLike('first_name', $searchValue)
|
||||
->countAllResults();
|
||||
}else{
|
||||
$totalRecordwithFilter = $this->activity_model->select('id_activity')
|
||||
->join('auth_user','auth_user.token = auth_activity.user')
|
||||
->orLike('first_name', $searchValue)
|
||||
->where('auth_activity.user',$session->get('token'))
|
||||
->countAllResults();
|
||||
}
|
||||
|
||||
//Fetch records
|
||||
if($session->get('dashboard')=='admin' && !empty($all)){
|
||||
$records = $this->activity_model->select('auth_activity.*,concat(first_name, " (",email, ")") AS name')
|
||||
->join('auth_user','auth_user.token = auth_activity.user')
|
||||
->orLike('first_name', $searchValue)
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
}else{
|
||||
$records = $this->activity_model->select('auth_activity.*,concat(first_name, " (",email, ")") AS name')
|
||||
->join('auth_user','auth_user.token = auth_activity.user')
|
||||
->orLike('first_name', $searchValue)
|
||||
->where('auth_activity.user',$session->get('token'))
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
}
|
||||
|
||||
|
||||
//Data records
|
||||
$data = array();
|
||||
foreach($records as $record ){
|
||||
$data[] = array(
|
||||
"name"=>$record['name'],
|
||||
"level"=>$record['level'],
|
||||
"event"=>$record['event'],
|
||||
"ip"=>$record['ip'],
|
||||
"os"=>$record['os'],
|
||||
"browser"=>$record['browser'],
|
||||
"created_at"=>$record['created_at']
|
||||
);
|
||||
}
|
||||
|
||||
//Response
|
||||
$response = array(
|
||||
"draw" => intval($draw),
|
||||
"iTotalRecords" => $totalRecords,
|
||||
"iTotalDisplayRecords" => $totalRecordwithFilter,
|
||||
"aaData" => $data,
|
||||
"token" => csrf_hash() // New token hash
|
||||
);
|
||||
return $this->response->setJSON($response);
|
||||
}else{
|
||||
return $this->response->setJSON(["error"=>true]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCronHistory(){
|
||||
$postData = service('request')->getVar();
|
||||
if($postData != null && isset($postData->data)){
|
||||
$dtpostData = $postData->data;
|
||||
|
||||
//Read value
|
||||
$draw = $dtpostData->draw;
|
||||
$start = $dtpostData->start;
|
||||
$rowperpage = $dtpostData->length; // Rows display per page
|
||||
$columnIndex = $dtpostData->order[0]->column; // Column index
|
||||
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
|
||||
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
|
||||
$searchValue = $dtpostData->search->value; // Search value
|
||||
|
||||
//Total number of records without filtering
|
||||
$totalRecords = $this->crontab_model->select('id_crontab')
|
||||
->countAllResults();
|
||||
|
||||
//Total number of records with filtering
|
||||
$totalRecordwithFilter = $this->crontab_model->select('id_crontab')
|
||||
->orLike('routine', $searchValue)
|
||||
->orLike('error', $searchValue)
|
||||
->countAllResults();
|
||||
|
||||
//Fetch records
|
||||
$records = $this->crontab_model->select('*')
|
||||
->orLike('routine', $searchValue)
|
||||
->orLike('error', $searchValue)
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
|
||||
//Data records
|
||||
$data = array();
|
||||
foreach($records as $record ){
|
||||
$data[] = array(
|
||||
"routine"=>$record['routine'],
|
||||
"error"=>$record['error'],
|
||||
"created_at"=>$record['created_at']
|
||||
);
|
||||
}
|
||||
|
||||
//Response
|
||||
$response = array(
|
||||
"draw" => intval($draw),
|
||||
"iTotalRecords" => $totalRecords,
|
||||
"iTotalDisplayRecords" => $totalRecordwithFilter,
|
||||
"aaData" => $data,
|
||||
"token" => csrf_hash() // New token hash
|
||||
);
|
||||
return $this->response->setJSON($response);
|
||||
}else{
|
||||
return $this->response->setJSON(["error"=>true]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getNotification(){
|
||||
$postData = service('request')->getVar();
|
||||
if($postData != null && isset($postData->data)){
|
||||
$dtpostData = $postData->data;
|
||||
|
||||
//Read value
|
||||
$draw = $dtpostData->draw;
|
||||
$start = $dtpostData->start;
|
||||
$rowperpage = $dtpostData->length; // Rows display per page
|
||||
$columnIndex = $dtpostData->order[0]->column; // Column index
|
||||
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
|
||||
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
|
||||
$searchValue = $dtpostData->search->value; // Search value
|
||||
|
||||
//Total number of records without filtering
|
||||
$totalRecords = $this->notification_model->select('id_notification')
|
||||
->join('user AS sender','notification.user_sender = sender.token','left')
|
||||
->join('user AS recipient','notification.user_recipient = recipient.token','left')
|
||||
->countAllResults();
|
||||
|
||||
//Total number of records with filtering
|
||||
$totalRecordwithFilter = $this->notification_model->select('id_notification')
|
||||
->join('user AS sender','notification.user_sender = sender.token','left')
|
||||
->join('user AS recipient','notification.user_recipient = recipient.token','left')
|
||||
->orLike('title', $searchValue)
|
||||
->orLike('sender.first_name', $searchValue)
|
||||
->orLike('recipient.first_name', $searchValue)
|
||||
->countAllResults();
|
||||
|
||||
//Fetch records
|
||||
$records = $this->notification_model->select('notification.token, sender.first_name AS sender, recipient.first_name AS recipient, notification.title, is_send_email, is_read, notification.created_at')
|
||||
->join('user AS sender','notification.user_sender = sender.token','left')
|
||||
->join('user AS recipient','notification.user_recipient = recipient.token','left')
|
||||
->orLike('title', $searchValue)
|
||||
->orLike('sender.first_name', $searchValue)
|
||||
->orLike('recipient.first_name', $searchValue)
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
|
||||
//Format records
|
||||
foreach ($records as $key => $value){
|
||||
$records[$key]['options'] = ''.
|
||||
'<div class="btn-group mr-1 mb-1" xmlns="http://www.w3.org/1999/html">
|
||||
<button type="button" class="btn btn-primary btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
'.lang("App.notification_grid_options").'
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<button type="button" class="dropdown-item" onclick="delete_this(\''.$records[$key]['token'].'\');"><i class="fas fa-trash"></i> '.lang("App.user_btn_delete").'</button>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
|
||||
//Data records
|
||||
$data = array();
|
||||
foreach($records as $record ){
|
||||
$data[] = array(
|
||||
"sender"=>$record['sender'],
|
||||
"recipient"=>$record['recipient'],
|
||||
"title"=>$record['title'],
|
||||
"is_send_email"=>$record['is_send_email'],
|
||||
"is_read"=>$record['is_read'],
|
||||
"created_at"=>$record['created_at'],
|
||||
"options"=>$record['options']
|
||||
);
|
||||
}
|
||||
|
||||
//Response
|
||||
$response = array(
|
||||
"draw" => intval($draw),
|
||||
"iTotalRecords" => $totalRecords,
|
||||
"iTotalDisplayRecords" => $totalRecordwithFilter,
|
||||
"aaData" => $data,
|
||||
"token" => csrf_hash() // New token hash
|
||||
);
|
||||
return $this->response->setJSON($response);
|
||||
}else{
|
||||
return $this->response->setJSON(["error"=>true]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getMyNotification(){
|
||||
$postData = service('request')->getVar();
|
||||
if($postData != null && isset($postData->data)){
|
||||
$dtpostData = $postData->data;
|
||||
|
||||
//Read value
|
||||
$draw = $dtpostData->draw;
|
||||
$start = $dtpostData->start;
|
||||
$rowperpage = $dtpostData->length; // Rows display per page
|
||||
$columnIndex = $dtpostData->order[0]->column; // Column index
|
||||
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
|
||||
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
|
||||
$searchValue = $dtpostData->search->value; // Search value
|
||||
|
||||
//Total number of records without filtering
|
||||
$totalRecords = $this->notification_model->select('id_notification')
|
||||
->join('user AS sender','notification.user_sender = sender.token','left')
|
||||
->join('user AS recipient','notification.user_recipient = recipient.token','left')
|
||||
->where('user_recipient',$this->token_user)
|
||||
->countAllResults();
|
||||
|
||||
//Total number of records with filtering
|
||||
$totalRecordwithFilter = $this->notification_model->select('id_notification')
|
||||
->join('user AS sender','notification.user_sender = sender.token','left')
|
||||
->join('user AS recipient','notification.user_recipient = recipient.token','left')
|
||||
->orLike('title', $searchValue)
|
||||
->where('user_recipient',$this->token_user)
|
||||
->countAllResults();
|
||||
|
||||
//Fetch records
|
||||
$records = $this->notification_model->select('notification.token, sender.first_name AS sender, recipient.first_name AS recipient, notification.title, is_read, notification.created_at')
|
||||
->join('user AS sender','notification.user_sender = sender.token','left')
|
||||
->join('user AS recipient','notification.user_recipient = recipient.token','left')
|
||||
->orLike('title', $searchValue)
|
||||
->where('user_recipient',$this->token_user)
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
|
||||
//Format records
|
||||
foreach ($records as $key => $value){
|
||||
$records[$key]['options'] = '<a class="btn btn-primary" href="/my/notification_view/'.$records[$key]['token'].'"><i class="fas fa-eye"></i> '.lang("App.notification_view_btn").'</a>';
|
||||
}
|
||||
|
||||
//Data records
|
||||
$data = array();
|
||||
foreach($records as $record ){
|
||||
$data[] = array(
|
||||
"sender"=>$record['sender'],
|
||||
"recipient"=>$record['recipient'],
|
||||
"title"=>$record['title'],
|
||||
"created_at"=>$record['created_at'],
|
||||
"is_read"=>$record['is_read'],
|
||||
"options"=>$record['options']
|
||||
);
|
||||
}
|
||||
|
||||
//Response
|
||||
$response = array(
|
||||
"draw" => intval($draw),
|
||||
"iTotalRecords" => $totalRecords,
|
||||
"iTotalDisplayRecords" => $totalRecordwithFilter,
|
||||
"aaData" => $data,
|
||||
"token" => csrf_hash() // New token hash
|
||||
);
|
||||
return $this->response->setJSON($response);
|
||||
}else{
|
||||
return $this->response->setJSON(["error"=>true]);
|
||||
}
|
||||
}
|
||||
}
|
||||
623
ci4/app/Controllers/Albaranes/Albaran.php
Executable file
623
ci4/app/Controllers/Albaranes/Albaran.php
Executable file
@ -0,0 +1,623 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Albaranes;
|
||||
use App\Entities\Albaranes\AlbaranEntity;
|
||||
use App\Models\Albaranes\AlbaranModel;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
|
||||
class Albaran extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
protected $modelName = AlbaranModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectNameCc = 'albaran';
|
||||
protected static $singularObjectName = 'Albaran';
|
||||
protected static $pluralObjectName = 'Albaranes';
|
||||
protected static $controllerSlug = 'albaran';
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function delete($id = null)
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
$model_linea->where('albaran_id', $id)->delete();
|
||||
|
||||
$this->model->where('id', $id)->delete();
|
||||
|
||||
$data = [
|
||||
'error' => 0,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function editAlbaran($albaran_id){
|
||||
|
||||
$albaran = $this->model->find($albaran_id);
|
||||
if ($albaran == false) {
|
||||
return redirect()->to(base_url('albaranesList'));
|
||||
}
|
||||
$this->viewData['boxTitle'] = lang('Albaran.editAlbaran') . ' ' . $albaran->numero_albaran;
|
||||
$this->viewData['albaranId'] = $albaran_id;
|
||||
|
||||
return view('themes/vuexy/form/logistica/albaranes/viewAlbaranesEdit', $this->viewData);
|
||||
}
|
||||
|
||||
public function addLinea($albaran_id)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
// si es un post, es el iva
|
||||
if ($this->request->getPost()) {
|
||||
$reqData = $this->request->getPost();
|
||||
$albaran_id = $reqData['albaran_id'] ?? 0;
|
||||
|
||||
$albaran = $this->model->find($albaran_id);
|
||||
if ($albaran == false) {
|
||||
$data = [
|
||||
'error' => 'Albaran no encontrado',
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
$presupuesto_model = model('App\Models\Presupuestos\PresupuestoModel');
|
||||
$presupuesto = $presupuesto_model->find($albaran->presupuesto_id);
|
||||
if ($presupuesto == false) {
|
||||
$data = [
|
||||
'error' => 'Presupuesto no encontrado',
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
$iva_reducido = $presupuesto->iva_reducido;
|
||||
$lineas = $model_linea->where('albaran_id', $albaran_id)->findAll();
|
||||
$total = 0;
|
||||
foreach ($lineas as $linea) {
|
||||
$total += $linea->total;
|
||||
}
|
||||
$iva = $iva_reducido ? $total * 4.0 / 100 : $total * 21.0 / 100;
|
||||
$data_linea = [
|
||||
'albaran_id' => $albaran_id,
|
||||
'titulo' => $iva_reducido ? lang('Pedidos.iva4') : lang('Pedidos.iva21'),
|
||||
'cantidad' => 1,
|
||||
'precio_unidad' => round($iva, 2),
|
||||
'total' => round($iva, 2),
|
||||
'user_created_id' => auth()->user()->id,
|
||||
'user_updated_id' => auth()->user()->id
|
||||
];
|
||||
$id_linea = $model_linea->insert($data_linea);
|
||||
$linea = $model_linea->find($id_linea);
|
||||
$data = [
|
||||
'error' => 0,
|
||||
'data' => $linea,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
$linea = [
|
||||
'albaran_id' => $albaran_id,
|
||||
'user_created_id' => auth()->user()->id,
|
||||
'user_updated_id' => auth()->user()->id
|
||||
];
|
||||
$id_linea = $model_linea->insert($linea);
|
||||
$data = $model_linea->find($id_linea);
|
||||
|
||||
$data = [
|
||||
'error' => 0,
|
||||
'data' => $data,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$user = auth()->user()->id;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$pedido_id = $reqData['pedido_id'] ?? 0;
|
||||
$presupuestos_id = $reqData['presupuestos_id'] ?? 0;
|
||||
|
||||
$return_data = $this->model->generarAlbaranes($pedido_id, $presupuestos_id, $user);
|
||||
$data = [
|
||||
'data' => $return_data,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAlbaran()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$fieldName = $this->request->getPost('fieldName');
|
||||
$fieldValue = $this->request->getPost('fieldValue');
|
||||
$id = $this->request->getPost('albaranId');
|
||||
|
||||
if ($id == null) {
|
||||
$data = [
|
||||
'success' => false,
|
||||
'message' => lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Pedidos.albaran')), $id]),
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
$albaranEntity = $this->model->find($id);
|
||||
|
||||
if ($albaranEntity == false) {
|
||||
$data = [
|
||||
'success' => false,
|
||||
'message' => lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Pedidos.albaran')), $id]),
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
if($fieldName == 'fecha_albaran'){
|
||||
if($fieldValue == null || $fieldValue == '')
|
||||
$fieldValue = null;
|
||||
else
|
||||
$fieldValue = date('Y-m-d H:i:s', strtotime($fieldValue));
|
||||
}
|
||||
|
||||
$albaranEntity->fill([
|
||||
$fieldName => $fieldValue,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
]);
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $albaranEntity);
|
||||
if ($successfulResult) {
|
||||
$data = [
|
||||
'success' => true,
|
||||
'message' => lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.',
|
||||
];
|
||||
} else {
|
||||
$data = [
|
||||
'success' => false,
|
||||
'message' => lang('Basic.global.updateError', [lang('Basic.global.record')]) . '.',
|
||||
];
|
||||
}
|
||||
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updateLinea($id = null)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
if ($id == null):
|
||||
$data = [
|
||||
'error' => 2,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
endif;
|
||||
$id = filter_var($id, FILTER_SANITIZE_URL);
|
||||
$albaranEntity = $model_linea->find($id);
|
||||
|
||||
if ($albaranEntity == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Pedidos.albaran')), $id]);
|
||||
$data = [
|
||||
'error' => $message,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
endif;
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $model_linea->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Pedidos.albaran'))]);
|
||||
$this->session->setFlashdata('formErrors', $model_linea->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$albaranEntity->fill($sanitizedData);
|
||||
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
$id = $albaranEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
$data = [
|
||||
'error' => 0,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$data = [
|
||||
'error' => 1,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getAlbaranes()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$envio_id = $this->request->getGet('envio_id');
|
||||
$albaranes = $this->model->getAlbaranesEnvio($envio_id);
|
||||
$data = [
|
||||
'status' => true,
|
||||
'data' => $albaranes,
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAlbaran()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
$albaran = $this->model->getAlbaranData($id);
|
||||
$data = [
|
||||
'success' => true,
|
||||
'data' => $albaran,
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function generateAlbaran()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$envio_id = $reqData['envio_id'] ?? 0;
|
||||
$envio_lineas = $reqData['envio_lineas'] ?? [];
|
||||
$cajas = $reqData['cajas'] ?? 0;
|
||||
|
||||
$response = $this->model->generarAlbaranes($envio_id, $envio_lineas, $cajas);
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$pedidosFilter = $this->request->getGet('pedidosFilter');
|
||||
$q = $this->model->getDatatableQuery();
|
||||
|
||||
if($pedidosFilter != null && !empty($pedidosFilter)) {
|
||||
$q->groupStart();
|
||||
$q->like('t4.id', $pedidosFilter);
|
||||
$q->groupEnd();
|
||||
}
|
||||
$result = DataTable::of($q)
|
||||
->add(
|
||||
"action",
|
||||
callback: function ($q) {
|
||||
return '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
);
|
||||
|
||||
return $result->toJson(returnAsObject: true);
|
||||
}
|
||||
|
||||
public function datatablesLineasAlbaran()
|
||||
{
|
||||
|
||||
$albaranId = $this->request->getGet('albaranId');
|
||||
$model = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
$q = $model->getDatatableQuery($albaranId);
|
||||
|
||||
$result = DataTable::of($q)
|
||||
->add(
|
||||
"action",
|
||||
callback: function ($q) {
|
||||
return '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-albaran-lineas mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
)
|
||||
->edit('pedido', function ($q) {
|
||||
return '<a href="' . base_url('pedidos/edit/' . $q->pedido) . '" target="_blank">' . $q->pedido . '</a>';
|
||||
})
|
||||
->edit('unidades', function ($q) {
|
||||
if(str_contains($q->titulo, 'IVA'))
|
||||
return null;
|
||||
else
|
||||
return '<input type="number" class="form-control form-control-sm input-albaran-linea text-center"
|
||||
value="' . $q->unidades . '" data-id="' . $q->id . '" data-field="cantidad" />';
|
||||
})
|
||||
->edit('titulo', function ($q) {
|
||||
return '<input type="text" class="form-control form-control-sm input-albaran-linea" value="' . $q->titulo .
|
||||
'" data-id="' . $q->id . '" data-field="titulo" />';
|
||||
})
|
||||
->edit('cajas', function ($q) {
|
||||
return '<input class="form-control input-albaran-linea
|
||||
form-control-sm text-center" value="' . $q->cajas . '" data-id="' . $q->id . '" data-field="cajas" />';
|
||||
})
|
||||
->edit('unidades_cajas', function ($q) {
|
||||
return '<input class="form-control input-albaran-linea
|
||||
form-control-sm text-center" value="' . $q->unidades_cajas . '" data-id="' . $q->id . '" data-field="unidades_cajas" />';
|
||||
})
|
||||
->edit('total', function ($q) {
|
||||
return '<input class="form-control autonumeric-2 input-albaran-linea
|
||||
form-control-sm text-center" value="' . $q->total . '" data-id="' . $q->id . '" data-field="total" />';
|
||||
})
|
||||
->edit('precio_unidad', function ($q) {
|
||||
if(str_contains($q->titulo, 'IVA'))
|
||||
return null;
|
||||
else
|
||||
return '<input class="form-control autonumeric-4 form-control-sm text-center input-albaran-linea" value="' .
|
||||
number_format((float) $q->precio_unidad, 4, ',', '') .
|
||||
'" data-id="' . $q->id . '" data-field="precio_unidad" />';
|
||||
});
|
||||
|
||||
|
||||
return $result->toJson(returnAsObject: true);
|
||||
}
|
||||
|
||||
public function updateAlbaranLinea(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
|
||||
|
||||
$fieldName = $this->request->getPost('fieldName');
|
||||
$fieldValue = $this->request->getPost('fieldValue');
|
||||
$id = $this->request->getPost('lineaId');
|
||||
|
||||
$linea = $model_linea->find($id);
|
||||
if ($linea == false) {
|
||||
$data = [
|
||||
'success' => false,
|
||||
'message' => lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Pedidos.albaran')), $id]),
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
if($fieldName == 'cantidad') {
|
||||
$linea->total = round($linea->precio_unidad * intval($fieldValue), 4);
|
||||
$linea->cantidad = intval($fieldValue);
|
||||
}
|
||||
else if($fieldName == 'precio_unidad') {
|
||||
$fieldValue2 = str_replace(',', '.', $fieldValue);
|
||||
$linea->total = round(round(floatval($fieldValue2), 4) * intval($linea->cantidad), 2);
|
||||
$linea->precio_unidad = round(floatval($fieldValue2), 4);
|
||||
}
|
||||
else if($fieldName == 'total') {
|
||||
$linea->total = round(floatval($fieldValue), 2);
|
||||
$linea->precio_unidad = round(floatval($fieldValue) / intval($linea->cantidad), 4);
|
||||
}
|
||||
else{
|
||||
$linea->$fieldName = $fieldValue;
|
||||
}
|
||||
$linea->user_updated_id = auth()->user()->id;
|
||||
$linea->updated_at = date('Y-m-d H:i:s');
|
||||
|
||||
$model_linea->update($id, $linea->toArray());
|
||||
|
||||
$data = [
|
||||
'success' => true,
|
||||
'message' => lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.',
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function addLineasIva(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$albaran_id = $this->request->getPost('albaranId');
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
|
||||
$lineas_albaran = $model_linea->where('albaran_id', $albaran_id)->findAll();
|
||||
$iva_reducido = 0;
|
||||
$iva_no_reducido = 0;
|
||||
foreach ($lineas_albaran as $linea) {
|
||||
if($linea->iva_reducido == 1) {
|
||||
$iva_reducido += round(floatval($linea->total)*0.04, 2);
|
||||
} else {
|
||||
$iva_no_reducido += round(floatval($linea->total)*0.21, 2);
|
||||
}
|
||||
}
|
||||
$iva_reducido = round($iva_reducido, 2);
|
||||
$iva_no_reducido = round($iva_no_reducido, 2);
|
||||
if($iva_reducido > 0) {
|
||||
$linea = [
|
||||
'albaran_id' => $albaran_id,
|
||||
'titulo' => lang('Albaran.iva4'),
|
||||
'total' => round($iva_reducido, 2),
|
||||
'user_created_id' => auth()->user()->id,
|
||||
'user_updated_id' => auth()->user()->id
|
||||
];
|
||||
$model_linea->insert($linea);
|
||||
}
|
||||
if($iva_no_reducido > 0) {
|
||||
$linea = [
|
||||
'albaran_id' => $albaran_id,
|
||||
'titulo' => lang('Albaran.iva21'),
|
||||
'total' => round($iva_no_reducido, 2),
|
||||
'user_created_id' => auth()->user()->id,
|
||||
'user_updated_id' => auth()->user()->id
|
||||
];
|
||||
$model_linea->insert($linea);
|
||||
}
|
||||
$data = [
|
||||
'success' => true,
|
||||
'message' => lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.',
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function addBlankLineaAlbaran(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$albaran_id = $this->request->getPost('albaranId');
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
|
||||
$linea = [
|
||||
'albaran_id' => $albaran_id,
|
||||
'user_created_id' => auth()->user()->id,
|
||||
'user_updated_id' => auth()->user()->id
|
||||
];
|
||||
$id_linea = $model_linea->insert($linea);
|
||||
$data = $model_linea->find($id_linea);
|
||||
|
||||
$data = [
|
||||
'success' => true,
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function borrarLinea()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$id = $reqData['linea'] ?? 0;
|
||||
$id = filter_var($id, FILTER_SANITIZE_URL);
|
||||
$albaranLineaEntity = $model_linea->find($id);
|
||||
|
||||
if ($albaranLineaEntity == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Pedidos.albaran')), $id]);
|
||||
$data = [
|
||||
'success' => false,
|
||||
'error' => $message,
|
||||
];
|
||||
return $this->respond($data);
|
||||
endif;
|
||||
|
||||
$successfulResult = $model_linea->skipValidation(true)->update($id, ['deleted_at' => date('Y-m-d H:i:s')]);
|
||||
|
||||
if ($successfulResult):
|
||||
$data = [
|
||||
'success' => true,
|
||||
];
|
||||
else:
|
||||
$data = [
|
||||
'success' => false,
|
||||
'error' => lang('Basic.global.deleteError', [lang('Basic.global.record')]) . '.',
|
||||
];
|
||||
endif;
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function borrarAlbaran()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$id = $this->request->getPost('albaranId');
|
||||
$model_linea = model('App\Models\Albaranes\AlbaranLineaModel');
|
||||
$model_linea->where('albaran_id', $id)->delete();
|
||||
|
||||
$this->model->where('id', $id)->delete();
|
||||
|
||||
$data = [
|
||||
'success' => true
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\SettingsModel;
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\HTTP\CLIRequest;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
@ -37,7 +35,7 @@ class BaseController extends Controller
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $helpers = ['general', 'go_common'];
|
||||
protected $helpers = ['general', 'go_common', 'rbac'];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
75
ci4/app/Controllers/BaseResourceController.php
Normal file → Executable file
75
ci4/app/Controllers/BaseResourceController.php
Normal file → Executable file
@ -43,23 +43,23 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
*/
|
||||
protected static $pluralObjectName;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Path for the views directory for the extending view controller
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $viewPath;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* JJO: Variable para indicar si el controlador hace soft_delete o no
|
||||
*
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $soft_delete = false;
|
||||
/**
|
||||
* JJO: Variable quién puede ver los registros borrados
|
||||
*
|
||||
*
|
||||
* 0 -> Not Deleted
|
||||
* 1 -> Soft Deleted, shows up in lists of deleted items for management users
|
||||
* 2 -> Soft Deleted, does not show up for any user except admin users
|
||||
@ -85,7 +85,7 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $helpers = ['session', 'go_common', 'form', 'text', 'general']; //JJO
|
||||
protected $helpers = ['session', 'go_common', 'form', 'text', 'general', 'rbac']; //JJO
|
||||
|
||||
/**
|
||||
* Initializer method.
|
||||
@ -123,7 +123,7 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
$this->viewData['viewPath'] = static::$viewPath;
|
||||
|
||||
|
||||
$this->viewData['currentLocale'] = $this->request->getLocale();
|
||||
|
||||
/* IMN */
|
||||
@ -159,7 +159,7 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
}
|
||||
|
||||
if (!isset($this->viewData['formAction'])) {
|
||||
$this->viewData['formAction'] = base_url(strtolower($this->viewData['currentModule']) . '/' . $formActionSuffix . '/' . $action );
|
||||
$this->viewData['formAction'] = base_url(strtolower($this->viewData['currentModule']) . '/' . $formActionSuffix . '/' . $action);
|
||||
}
|
||||
|
||||
if ((!isset($this->viewData['boxTitle']) || empty($this->viewData['boxTitle'])) && isset(static::$singularObjectName) && !empty(static::$singularObjectName)) {
|
||||
@ -223,29 +223,28 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
public function delete($id = null)
|
||||
{
|
||||
if (!empty(static::$pluralObjectNameCc) && !empty(static::$singularObjectNameCc)) {
|
||||
$objName = mb_strtolower(lang(ucfirst(static::$pluralObjectNameCc).'.'.static::$singularObjectNameCc));
|
||||
$objName = mb_strtolower(lang(ucfirst(static::$pluralObjectNameCc) . '.' . static::$singularObjectNameCc));
|
||||
} else {
|
||||
$objName = lang('Basic.global.record');
|
||||
}
|
||||
|
||||
if (!$this->soft_delete){
|
||||
|
||||
if (!$this->soft_delete) {
|
||||
|
||||
if (!$this->model->delete($id)) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$rawResult = $this->model->where('id',$id)
|
||||
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'is_deleted' => $this->delete_flag])
|
||||
$rawResult = $this->model->where('id', $id)
|
||||
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'is_deleted' => $this->delete_flag])
|
||||
->update();
|
||||
if (!$rawResult) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||
@ -261,20 +260,18 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
protected function canValidate($customValidationRules = null, $customValidationMessages = null)
|
||||
{
|
||||
|
||||
if($customValidationRules == null){
|
||||
if ($customValidationRules == null) {
|
||||
$validationRules = $this->model->validationRules ?? $this->formValidationRules ?? null;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$validationRules = $customValidationRules;
|
||||
}
|
||||
if ($validationRules == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($customValidationMessages == null){
|
||||
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;;
|
||||
}
|
||||
else{
|
||||
if ($customValidationMessages == null) {
|
||||
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;;
|
||||
} else {
|
||||
$validationErrorMessages = $customValidationMessages;
|
||||
}
|
||||
|
||||
@ -283,7 +280,7 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
} else {
|
||||
$valid = $this->validate($validationRules);
|
||||
}
|
||||
|
||||
|
||||
$this->validationErrors = $valid ? '' : $this->validator->getErrors();
|
||||
|
||||
/*
|
||||
@ -303,7 +300,8 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
* @param array|null $postData
|
||||
* @return array
|
||||
*/
|
||||
protected function sanitized(array $postData = null, bool $nullIfEmpty = false) {
|
||||
protected function sanitized(array $postData = null, bool $nullIfEmpty = false)
|
||||
{
|
||||
if ($postData == null) {
|
||||
$postData = $this->request->getPost();
|
||||
}
|
||||
@ -317,7 +315,7 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
}
|
||||
return $sanitizedData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Custom fail method needed when CSRF token regeneration is on in security settings
|
||||
* @param string|array $messages
|
||||
@ -326,15 +324,15 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
* @param string $customMessage
|
||||
* @return mixed
|
||||
*/
|
||||
protected function failWithNewToken($messages, int $status = 400, string $code = null, string $customMessage = '') {
|
||||
protected function failWithNewToken($messages, int $status = 400, string $code = null, string $customMessage = '')
|
||||
{
|
||||
|
||||
if (! is_array($messages))
|
||||
{
|
||||
if (!is_array($messages)) {
|
||||
$messages = ['error' => $messages];
|
||||
}
|
||||
$response = [
|
||||
'status' => $status,
|
||||
'error' => $status,
|
||||
'status' => $status,
|
||||
'error' => $status,
|
||||
'messages' => $messages,
|
||||
csrf_token() => csrf_hash()
|
||||
];
|
||||
@ -360,7 +358,8 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
* Convenience method for common exception handling
|
||||
* @param \Exception $e
|
||||
*/
|
||||
protected function dealWithException(\Exception $e) {
|
||||
protected function dealWithException(\Exception $e)
|
||||
{
|
||||
// using another try / catch block to prevent to avoid CodeIgniter bug throwing trivial exceptions for querying DB errors
|
||||
try {
|
||||
$query = $this->model->db->getLastQuery();
|
||||
@ -368,16 +367,16 @@ abstract class BaseResourceController extends \CodeIgniter\RESTful\ResourceContr
|
||||
$dbError = $this->model->db->error();
|
||||
$userFriendlyErrMsg = lang('Basic.global.persistErr1', [static::$singularObjectNameCc]);
|
||||
if (isset($dbError['code']) && $dbError['code'] == 1062) :
|
||||
$userFriendlyErrMsg .= PHP_EOL.lang('Basic.global.persistDuplErr', [static::$singularObjectNameCc]);
|
||||
$userFriendlyErrMsg .= PHP_EOL . lang('Basic.global.persistDuplErr', [static::$singularObjectNameCc]);
|
||||
endif;
|
||||
// $userFriendlyErrMsg = str_replace("'", "\'", $userFriendlyErrMsg); // Uncomment if experiencing unescaped single quote errors
|
||||
log_message('error', $userFriendlyErrMsg.PHP_EOL.$e->getMessage().PHP_EOL.$queryStr);
|
||||
log_message('error', $userFriendlyErrMsg . PHP_EOL . $e->getMessage() . PHP_EOL . $queryStr);
|
||||
if (isset($dbError['message']) && !empty($dbError['message'])) :
|
||||
log_message('error', $dbError['code'].' : '.$dbError['message']);
|
||||
log_message('error', $dbError['code'] . ' : ' . $dbError['message']);
|
||||
endif;
|
||||
$this->viewData['errorMessage'] = $userFriendlyErrMsg;
|
||||
} catch (\Exception $e2) {
|
||||
log_message('debug', 'You can probably safely ignore this: In attempt to check DB errors, CodeIgniter threw: '.PHP_EOL.$e2->getMessage());
|
||||
log_message('debug', 'You can probably safely ignore this: In attempt to check DB errors, CodeIgniter threw: ' . PHP_EOL . $e2->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
273
ci4/app/Controllers/Catalogo/CatalogoLibros.php
Normal file
273
ci4/app/Controllers/Catalogo/CatalogoLibros.php
Normal file
@ -0,0 +1,273 @@
|
||||
<?php
|
||||
namespace App\Controllers\Catalogo;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Entities\Catalogo\CatalogoLibroEntity;
|
||||
use App\Models\Catalogo\CatalogoLibroModel;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Presupuestos\ImportadorModel;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
|
||||
class CatalogoLibros extends BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = CatalogoLibroModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Catalogo';
|
||||
protected static $singularObjectNameCc = 'CatalogoLibros';
|
||||
protected static $pluralObjectName = 'Catalogos';
|
||||
protected static $pluralObjectNameCc = 'catalogos';
|
||||
|
||||
protected static $controllerSlug = 'catalogo';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/catalogo/';
|
||||
|
||||
protected $indexRoute = 'CatalogoLibrosList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Catalogo.listingPage');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_catalogo"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_catalogo_libros"), 'route' => route_to('catalogoLibrosList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Catalogo.catalogo')]),
|
||||
'catalogoLibrosEntity' => new CatalogoLibroEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . 'viewCatalogoLibrosList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$sanitizedData['user_created_id'] = auth()->user()->id;
|
||||
unset($sanitizedData['iskn']);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()):
|
||||
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['catalogoLibrosEntity'] = isset($sanitizedData) ? new CatalogoLibroEntity($sanitizedData) : new CatalogoLibroEntity();
|
||||
$this->viewData['formAction'] = route_to('catalogoLibrosAdd');
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Catalogo.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$catalogoLibrosEntity = $this->model->find($id);
|
||||
|
||||
if ($catalogoLibrosEntity == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Catalogo.pais')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
unset($sanitizedData['iskn']);
|
||||
$sanitizedData['user_update_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Catalogo.catalogo'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$catalogoLibrosEntity->fill($sanitizedData);
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
|
||||
if ($noException && $successfulResult):
|
||||
$id = $catalogoLibrosEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
|
||||
$this->viewData['catalogoLibrosEntity'] = $catalogoLibrosEntity;
|
||||
$this->viewData['formAction'] = route_to('catalogoLibrosEdit', $id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Catalogo.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
$reqData = $this->request->getGet();
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
|
||||
$q = $this->model->getDatatableQuery()->limit($length, $start);
|
||||
|
||||
$result = DataTable::of($q)
|
||||
->edit(
|
||||
"portada",
|
||||
function ($row, $meta) {
|
||||
if (is_null($row->cubierta_archivo)) {
|
||||
return '<img class="img-thumbnail" src="' . $row->portada . '" alt="Portada" style="max-height: 80px;">';
|
||||
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
)
|
||||
->add("actionBtns", callback: function ($q) {
|
||||
$actions = '';
|
||||
if (auth()->user()->can('catalogo.edit')) {
|
||||
$actions .= '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>';
|
||||
}
|
||||
if (auth()->user()->can('catalogo.delete')) {
|
||||
$actions .= '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>';
|
||||
}
|
||||
return $actions;
|
||||
});
|
||||
|
||||
return $result->toJson(returnAsObject: true);
|
||||
|
||||
}
|
||||
|
||||
/* IMN */
|
||||
public function getClientList()
|
||||
{
|
||||
$search = $this->request->getGet("q") ?? "";
|
||||
$data = (new ClienteModel())->getIdName($search);
|
||||
return $this->response->setJSON($data);
|
||||
|
||||
}
|
||||
|
||||
/* Historico de pedidos ERP antiguo */
|
||||
public function datatablePedidosAntiguos()
|
||||
{
|
||||
$reqData = $this->request->getGet();
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 10;
|
||||
$catalogoId = $reqData['catalogo_id'] ?? null;
|
||||
|
||||
// Instanciar el modelo directamente
|
||||
$importadorModel = new ImportadorModel();
|
||||
|
||||
$q = $importadorModel->getHistoricoPedidosCatalogo($catalogoId);
|
||||
|
||||
return DataTable::of($q)
|
||||
->setSearchableColumns([
|
||||
't1.id',
|
||||
't1.created_at',
|
||||
't1.tirada',
|
||||
't1.total',
|
||||
't1.estado'
|
||||
])
|
||||
->edit('total', fn($row) => number_format((float) $row->total, 2, ',', '.') . ' €')
|
||||
->edit('precio_ud', fn($row) => number_format((float) $row->total, 2, ',', '.') . ' €')
|
||||
->edit('created_at', fn($row) => date('d/m/Y', strtotime($row->created_at)))
|
||||
->add('actionBtns', function ($row) {
|
||||
return '<div class="btn-group btn-group-sm">
|
||||
<a href="https://gestion.safekat.es/pedido/detail/' . $row->id . '" class="btn btn-sm btn-info" target="_blank">
|
||||
<i class="ti ti-eye"></i> Ver
|
||||
</a>
|
||||
</div>';
|
||||
}, 'last')
|
||||
->toJson(returnAsObject: true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
817
ci4/app/Controllers/Chat/ChatController.php
Executable file
817
ci4/app/Controllers/Chat/ChatController.php
Executable file
@ -0,0 +1,817 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chat;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Chat\ChatDeparmentModel;
|
||||
use App\Models\Chat\ChatDeparmentUserModel;
|
||||
use App\Models\Chat\ChatMessageModel;
|
||||
use App\Models\Chat\ChatModel;
|
||||
use App\Models\ChatNotification;
|
||||
use App\Models\ChatUser;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Facturas\FacturaModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Models\Pedidos\PedidoModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use App\Services\ChatService;
|
||||
use App\Services\MessageService;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\Log\Logger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use CodeIgniter\I18n\Time;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
|
||||
class ChatController extends BaseController
|
||||
{
|
||||
protected ChatDeparmentModel $chatDeparmentModel;
|
||||
protected ChatDeparmentUserModel $chatDeparmentUserModel;
|
||||
protected ChatModel $chatModel;
|
||||
protected ChatMessageModel $chatMessageModel;
|
||||
protected UserModel $userModel;
|
||||
protected ClienteModel $clienteModel;
|
||||
protected ChatUser $chatUserModel;
|
||||
protected ChatNotification $chatNotificationModel;
|
||||
protected Validation $validation;
|
||||
protected ChatService $chatService;
|
||||
protected array $viewData;
|
||||
protected static $viewPath = 'themes/vuexy/form/mensajes/';
|
||||
|
||||
|
||||
public function initController(
|
||||
RequestInterface $request,
|
||||
ResponseInterface $response,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
parent::initController($request, $response, $logger);
|
||||
|
||||
// Add your code here.
|
||||
$this->chatDeparmentModel = model(ChatDeparmentModel::class);
|
||||
$this->chatDeparmentUserModel = model(ChatDeparmentUserModel::class);
|
||||
$this->chatModel = model(ChatModel::class);
|
||||
$this->chatMessageModel = model(ChatMessageModel::class);
|
||||
$this->userModel = model(UserModel::class);
|
||||
$this->clienteModel = model(ClienteModel::class);
|
||||
$this->chatUserModel = model(ChatUser::class);
|
||||
$this->chatNotificationModel = model(ChatNotification::class);
|
||||
$this->validation = service("validation");
|
||||
$this->chatService = service("chat");
|
||||
|
||||
}
|
||||
public function index() {}
|
||||
public function get_chat_departments(string $model,int $modelId)
|
||||
{
|
||||
|
||||
$data = $this->chatService->getChatDepartments($model,$modelId);
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_department_select()
|
||||
{
|
||||
$query = $this->chatDeparmentModel->getChatDepartmentSelect($this->request->getGet("q"));
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
public function get_chat_presupuesto(int $chat_department_id, int $presupuesto_id)
|
||||
{
|
||||
|
||||
$data = [
|
||||
"department" => $this->chatDeparmentModel->find($chat_department_id),
|
||||
"chat" => null,
|
||||
"messages" => null,
|
||||
"count" => 0,
|
||||
];
|
||||
$chat = $this->chatModel->getChatPresupuesto($chat_department_id, $presupuesto_id);
|
||||
if ($chat) {
|
||||
$data["messages"] = $this->chatMessageModel->get_chat_messages($chat->id);
|
||||
$this->chatMessageModel->set_chat_department_messages_as_read($chat->id);
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat->id, auth()->user()->id);
|
||||
|
||||
$data["count"] = count($data["messages"]);
|
||||
}
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_pedido(int $chat_department_id, int $pedido_id)
|
||||
{
|
||||
|
||||
$data = [
|
||||
"department" => $this->chatDeparmentModel->find($chat_department_id),
|
||||
"chat" => null,
|
||||
"messages" => null,
|
||||
"count" => 0,
|
||||
];
|
||||
$chat = $this->chatModel->getChatPedido($chat_department_id, $pedido_id);
|
||||
if ($chat) {
|
||||
$data["messages"] = $this->chatMessageModel->get_chat_messages($chat->id);
|
||||
$this->chatMessageModel->set_chat_department_messages_as_read($chat->id);
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat->id, auth()->user()->id);
|
||||
|
||||
$data["count"] = count($data["messages"]);
|
||||
}
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_factura(int $chat_department_id, int $factura_id)
|
||||
{
|
||||
|
||||
$data = [
|
||||
"department" => $this->chatDeparmentModel->find($chat_department_id),
|
||||
"chat" => null,
|
||||
"messages" => null,
|
||||
"count" => 0,
|
||||
];
|
||||
$chat = $this->chatModel->getChatFactura($chat_department_id, $factura_id);
|
||||
if ($chat) {
|
||||
$data["messages"] = $this->chatMessageModel->get_chat_messages($chat->id);
|
||||
$this->chatMessageModel->set_chat_department_messages_as_read($chat->id);
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat->id, auth()->user()->id);
|
||||
$data["count"] = count($data["messages"]);
|
||||
}
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_orden_trabajo(int $chat_department_id, int $orden_trabajo_id)
|
||||
{
|
||||
|
||||
$data = [
|
||||
"department" => $this->chatDeparmentModel->find($chat_department_id),
|
||||
"chat" => null,
|
||||
"messages" => null,
|
||||
"count" => 0,
|
||||
];
|
||||
$chat = $this->chatModel->getChatOrdenTrabajo($chat_department_id, $orden_trabajo_id);
|
||||
if ($chat) {
|
||||
$data["messages"] = $this->chatMessageModel->get_chat_messages($chat->id);
|
||||
$this->chatMessageModel->set_chat_department_messages_as_read($chat->id);
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat->id, auth()->user()->id);
|
||||
$data["count"] = count($data["messages"]);
|
||||
}
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_direct_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["chatId"] = $chat_id;
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
|
||||
return view(static::$viewPath . 'messageChat', $this->viewData);
|
||||
}
|
||||
public function get_chat_presupuesto_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["modelId"] = $chat->presupuesto_id;
|
||||
$this->viewData["type"] = "presupuesto";
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
|
||||
if ($chat->chat_department_id) {
|
||||
return view(static::$viewPath . 'messageChatPresupuesto', $this->viewData);
|
||||
} else {
|
||||
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function get_chat_pedido_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["modelId"] = $chat->pedido_id;
|
||||
$this->viewData["type"] = "pedido";
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
if ($chat->chat_department_id) {
|
||||
return view(static::$viewPath . 'messageChatPedido', $this->viewData);
|
||||
} else {
|
||||
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function get_chat_factura_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["modelId"] = $chat->factura_id;
|
||||
$this->viewData["type"] = "factura";
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
|
||||
if ($chat->chat_department_id) {
|
||||
return view(static::$viewPath . 'messageChatFactura', $this->viewData);
|
||||
} else {
|
||||
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function get_chat_ot_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["modelId"] = $chat->orden_trabajo_id;
|
||||
$this->viewData["type"] = "ot";
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
|
||||
if ($chat->chat_department_id) {
|
||||
return view(static::$viewPath . 'messageChatFactura', $this->viewData);
|
||||
} else {
|
||||
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function get_chat(int $chat_id)
|
||||
{
|
||||
|
||||
$data = $this->chatModel->getChat($chat_id);
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function store_message($model)
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
$chatMessageEntity = $this->chatService->storeChatMessage($data["chat_department_id"],$model,$data["model_id"],$data);
|
||||
return $this->response->setJSON($chatMessageEntity);
|
||||
|
||||
}
|
||||
|
||||
public function store_chat_message_single()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$existChat = $this->chatMessageModel->get_chat_contact_messages($data["receiver_id"]);
|
||||
if (count($existChat) > 0) {
|
||||
$chatId = $existChat[0]->chat_id;
|
||||
} else {
|
||||
$chatId = $this->chatModel->createChatSingle();
|
||||
}
|
||||
$chat_message_id = $this->chatMessageModel->insert(
|
||||
[
|
||||
"chat_id" => $chatId,
|
||||
"sender_id" => auth()->user()->id,
|
||||
"message" => $data["message"],
|
||||
"receiver_id" => $data["receiver_id"],
|
||||
]
|
||||
);
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $data["receiver_id"]]);
|
||||
$dataResponse = $this->chatMessageModel->find($chat_message_id);
|
||||
return $this->response->setJSON($dataResponse);
|
||||
}
|
||||
public function get_chat_internal_contacts()
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
if ($auth_user->cliente_id) {
|
||||
$users = $this->chatModel->getOpenChatCliente($auth_user->id);
|
||||
} else {
|
||||
$users = $this->userModel->builder()
|
||||
->whereNotIn("id", [$auth_user->id])
|
||||
->where("deleted_at", null)
|
||||
->get()->getResultObject();
|
||||
}
|
||||
foreach ($users as $user) {
|
||||
$user->unreadMessages = $this->chatMessageModel->get_chat_messages_count($user->id);
|
||||
}
|
||||
usort($users, fn($a, $b) => $a->unreadMessages < $b->unreadMessages);
|
||||
return $this->response->setJSON($users);
|
||||
}
|
||||
public function get_chat_internal_contact(int $user_id)
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
// if ($auth_user->cliente_id) {
|
||||
// return $this->response->setJSON([]);
|
||||
// }
|
||||
$users = $this->userModel->builder()
|
||||
->where("deleted_at", null)
|
||||
->where("id", $user_id)
|
||||
->get()->getFirstRow();
|
||||
return $this->response->setJSON($users);
|
||||
}
|
||||
public function get_chat_internal_messages(int $user_id)
|
||||
{
|
||||
$conversation = $this->chatMessageModel->get_chat_contact_messages($user_id);
|
||||
|
||||
return $this->response->setJSON($conversation);
|
||||
}
|
||||
public function get_chat_cliente()
|
||||
{
|
||||
$cliente_id = auth()->user()->cliente_id;
|
||||
$response = $this->chatService->getAuthUserNotifications();
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
public function get_chat_department_presupuesto_users(int $chat_department_id, int $presupuesto_id)
|
||||
{
|
||||
$data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($presupuesto_id, 'presupuesto');
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_department_pedido_users(int $chat_department_id, $pedido_id)
|
||||
{
|
||||
$data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($pedido_id, 'pedido');
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_department_factura_users(int $chat_department_id, $factura_id)
|
||||
{
|
||||
$data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($factura_id, 'factura');
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_department_orden_trabajo_users(int $chat_department_id, $orden_trabajo_id)
|
||||
{
|
||||
$data = $this->chatDeparmentModel->find($chat_department_id)->withUsers($orden_trabajo_id, 'ot');
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_users_internal()
|
||||
{
|
||||
$query = $this->userModel->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"CONCAT(first_name,' ',last_name,'(',username,')') as name"
|
||||
]
|
||||
)->where("cliente_id", null)
|
||||
->where("deleted_at", null)
|
||||
->whereNotIn("id", [auth()->user()->id]);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("users.username", $this->request->getGet("q"))
|
||||
->orLike("CONCAT(first_name,' ',last_name)", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
public function get_chat_users_all()
|
||||
{
|
||||
$query = $this->userModel->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"CONCAT(first_name,' ',last_name) as name"
|
||||
]
|
||||
)
|
||||
->where("deleted_at", null)
|
||||
->whereNotIn("id", [auth()->user()->id]);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("CONCAT(first_name,' ',last_name)", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
public function get_presupuesto_client_users(int $presupuesto_id)
|
||||
{
|
||||
$pm = model(PresupuestoModel::class);
|
||||
$p = $pm->find($presupuesto_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$clienteContactos = $cm->querySelectClienteContacto($p->cliente_id,$this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function get_pedido_client_users(int $pedido_id)
|
||||
{
|
||||
$pm = model(PedidoModel::class);
|
||||
$p = $pm->find($pedido_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$clienteContactos = $cm->querySelectClienteContacto($p->cliente()->id,$this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function get_factura_client_users(int $factura_id)
|
||||
{
|
||||
$fm = model(FacturaModel::class);
|
||||
$f = $fm->find($factura_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$clienteContactos = $cm->querySelectClienteContacto($f->cliente_id,$this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function get_orden_trabajo_client_users(int $orden_trabajo_id)
|
||||
{
|
||||
$otm = model(OrdenTrabajoModel::class);
|
||||
$ot = $otm->find($orden_trabajo_id);
|
||||
$cm = model(ClienteModel::class);
|
||||
$cliente = $ot->pedido()->cliente();
|
||||
$clienteContactos = $cm->querySelectClienteContacto($cliente->id,$this->request->getGet('q'));
|
||||
return $this->response->setJSON($clienteContactos);
|
||||
}
|
||||
public function store_hebra(string $model)
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
$bodyData = $this->request->getPost();
|
||||
$status = $this->chatService->storeHebra($model,$bodyData['modelId'],$bodyData);
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente", "status" => $status]);
|
||||
}
|
||||
|
||||
public function update_hebra($chat_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$chatMessageId = $this->chatMessageModel->insert([
|
||||
"chat_id" => $chat_id,
|
||||
"message" => $bodyData["message"],
|
||||
"sender_id" => auth()->user()->id
|
||||
]);
|
||||
$actualUsers = $this->chatUserModel->builder()->select("user_id")->where("chat_id", $chat_id)->get()->getResultArray();
|
||||
$actualUsersArray = array_map(fn($x) => $x["user_id"], $actualUsers);
|
||||
|
||||
if (isset($bodyData["users"])) {
|
||||
foreach ($bodyData["users"] as $userId) {
|
||||
if (in_array($userId, $actualUsersArray) == false) {
|
||||
$chatUserData = ["user_id" => $userId, "chat_id" => $chat_id];
|
||||
$this->chatUserModel->insert($chatUserData);
|
||||
}
|
||||
$this->chatNotificationModel->insert(
|
||||
["chat_message_id" => $chatMessageId, "user_id" => $userId]
|
||||
);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Hebra actualizada correctamente", "status" => true]);
|
||||
}
|
||||
public function get_hebra(string $model,int $modelId)
|
||||
{
|
||||
$data = $this->chatService->getHebras($model,$modelId);
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
|
||||
|
||||
public function datatable_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$isAdmin = auth()->user()->inGroup('admin');
|
||||
$query = $this->chatModel->getQueryDatatable();
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i"))
|
||||
->edit('updated_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i"))
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
|
||||
->add("action", fn($q) => [
|
||||
"type" => "direct",
|
||||
"modelId" => $q->id,
|
||||
"isAdmin" => $isAdmin,
|
||||
"chatMessageId" => $q->chatMessageId,
|
||||
"lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]
|
||||
])
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_presupuesto_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$isAdmin = auth()->user()->inGroup('admin');
|
||||
$query = $this->chatModel->getQueryDatatableMessagePresupuesto($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("action", fn($q) => ["type" => "presupuesto", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_pedido_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$isAdmin = auth()->user()->inGroup('admin');
|
||||
$query = $this->chatModel->getQueryDatatableMessagePedido($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "pedido", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_factura_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$isAdmin = auth()->user()->inGroup('admin');
|
||||
$query = $this->chatModel->getQueryDatatableMessageFactura($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "factura", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_ot_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$isAdmin = auth()->user()->inGroup('admin');
|
||||
$query = $this->chatModel->getQueryDatatableMessageOrdenTrabajo($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "ot", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_direct_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$isAdmin = auth()->user()->inGroup('admin');
|
||||
$query = $this->chatModel->getQueryDatatableDirectMessages($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->edit("creator",fn($q) => $q->userId == $auth_user_id ? '<span class="badge text-bg-success w-100">'.lang("App.me").'</span>' : $q->creator)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->chatMessageId))
|
||||
->add("action", fn($q) => ["type" => "direct", "modelId" => $q->id, "isAdmin" => $isAdmin,"chatMessageId" => $q->chatMessageId, "lang" => [
|
||||
"view_chat" => lang('Chat.view_chat'),
|
||||
"view_by_alt_message" => lang('Chat.view_by_alt_message')
|
||||
]])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
public function get_notifications_not_viewed_from_message(int $chat_message_id)
|
||||
{
|
||||
$unviewedNotifications = $this->chatModel->getUsersNotificationNotViewedFromChat($chat_message_id);
|
||||
// $viewedNotifications = $this->chatModel->getUsersNotificationViewedFromChat($chat_message_id);
|
||||
|
||||
return $this->response->setJSON(
|
||||
[
|
||||
"data" => [
|
||||
"notifications" => $unviewedNotifications,
|
||||
],
|
||||
"chat_message_id" => $chat_message_id
|
||||
]
|
||||
);
|
||||
}
|
||||
public function store_new_direct_message()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$rules = [
|
||||
"title" => "required|string",
|
||||
"message" => "required|string",
|
||||
"users" => "required",
|
||||
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'message' => lang('App.global_alert_save_error'),
|
||||
'status' => 'error',
|
||||
'errors' => $this->validator->getErrors(),
|
||||
]);
|
||||
}
|
||||
$this->chatModel->createNewDirectChat(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("Chat.new_message_ok"), "status" => true]);
|
||||
}
|
||||
public function store_new_direct_message_client()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$rules = [
|
||||
"title" => "required|string",
|
||||
"message" => "required|string",
|
||||
"chat_department_id" => "required",
|
||||
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'message' => lang('App.global_alert_save_error'),
|
||||
'status' => 'error',
|
||||
'errors' => $this->validator->getErrors(),
|
||||
]);
|
||||
}
|
||||
$users = $this->chatDeparmentModel->getChatDepartmentUsers($bodyData["chat_department_id"]);
|
||||
$bodyData["users"] = array_map(fn($q) => $q->id, $users);
|
||||
dd(1);
|
||||
$this->chatModel->createNewDirectChat(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("Chat.new_message_ok"), "status" => true]);
|
||||
}
|
||||
public function get_chat_direct($chat_id)
|
||||
{
|
||||
$chatData = $this->chatModel->getChatDirect($chat_id);
|
||||
return $this->response->setJSON($chatData);
|
||||
}
|
||||
public function get_chat_direct_select_users($chat_id)
|
||||
{
|
||||
$chat_users_id = $this->chatUserModel->getChatUserArrayId($chat_id);
|
||||
|
||||
$query = $this->userModel->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"CONCAT(first_name,' ',last_name) as name"
|
||||
]
|
||||
)
|
||||
->where("deleted_at", null)
|
||||
->whereNotIn("id", $chat_users_id);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("CONCAT(first_name,' ',last_name)", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
public function store_chat_direct_users($chat_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$chat_users = [];
|
||||
foreach ($bodyData["users"] as $user_id) {
|
||||
$chat_users[] = ["chat_id" => $chat_id, "user_id" => $user_id];
|
||||
if ($bodyData["notification"]) {
|
||||
$this->chatModel->createNotificationsToNewChatUser($chat_id, $user_id);
|
||||
}
|
||||
}
|
||||
$this->chatUserModel->insertBatch($chat_users);
|
||||
return $this->response->setJSON(["message" => "ok", "status" => true]);
|
||||
}
|
||||
public function store_chat_direct_message(int $chat_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$auth_user = auth()->user();
|
||||
$bodyData["sender_id"] = $auth_user->id;
|
||||
$chat_message_id = $this->chatMessageModel->insert($bodyData);
|
||||
$users_id = $this->chatUserModel->getChatUserArrayId($chat_id);
|
||||
foreach ($users_id as $user_id) {
|
||||
if ($user_id != $auth_user->id) {
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user_id]);
|
||||
}
|
||||
};
|
||||
$message = $this->chatMessageModel->get_chat_message($chat_message_id);
|
||||
return $this->response->setJSON($message);
|
||||
}
|
||||
public function update_chat_direct_message_unread($chat_id)
|
||||
{
|
||||
$this->chatModel->setAsUnviewedChatUserNotifications($chat_id, auth()->user()->id);
|
||||
return $this->response->setJSON(["message" => "ok", "status" => true]);
|
||||
}
|
||||
public function store_chat_error_message()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$messageService = service('messages');
|
||||
$r = $messageService->createErrorMessagePresupuesto("Error", $bodyData['presupuesto_id']);
|
||||
return $this->response->setJSON(["message" => "ok", "data" => $r]);
|
||||
}
|
||||
public function delete_user_from_department($chat_department_id)
|
||||
{
|
||||
$data = $this->request->getRawInput();
|
||||
$user_id = auth()->user()->id;
|
||||
$adminExist = $this->chatDeparmentUserModel->where('chat_department_id', $chat_department_id)
|
||||
->where('user_id', $user_id)
|
||||
->where('pedido_id', null)
|
||||
->where('factura_id', null)
|
||||
->where('presupuesto_id', null)->countAllResults();
|
||||
if ($adminExist) {
|
||||
return $this->response->setJSON(["message" => lang('Chat.exit_admin_chat_wrong'), "status" => false]);
|
||||
}
|
||||
$chatDepartmentUserEntity = $this->chatDeparmentUserModel->where('chat_department_id', $chat_department_id)->where('user_id', $user_id)->where($data['model_fk'], $data['model_id_fk']);
|
||||
if ($chatDepartmentUserEntity->countAllResults() > 0) {
|
||||
$deleted = $this->chatDeparmentUserModel->where('chat_department_id', $chat_department_id)->where('user_id', $user_id)->delete(purge: true);
|
||||
return $this->response->setJSON(["message" => lang('Chat.exit_chat_ok'), "status" => true]);
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => lang('Chat.exit_chat_wrong'), "status" => false]);
|
||||
}
|
||||
}
|
||||
public function delete_user_admin_from_department($chat_department_id, $user_id)
|
||||
{
|
||||
$this->chatDeparmentUserModel->where('chat_department_id', $chat_department_id)->where('user_id', $user_id)->delete();
|
||||
return $this->response->setJSON(["message" => lang('Chat.user_deleted_ok'), "status" => true]);
|
||||
}
|
||||
public function subscribe_to_chat_deparment()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
$user_id = auth()->user()->id;
|
||||
$adminExist = $this->chatDeparmentUserModel->where('chat_department_id', $data['chat_department_id'])
|
||||
->where('user_id', $user_id)
|
||||
->where('pedido_id', null)
|
||||
->where('factura_id', null)
|
||||
->where('presupuesto_id', null)->countAllResults();
|
||||
if ($adminExist) {
|
||||
return $this->response->setJSON(["message" => lang('Chat.subscribe_chat_wrong'), "status" => false]);
|
||||
}
|
||||
$chatDepartmentUserEntity = $this->chatDeparmentUserModel->where('chat_department_id', $data['chat_department_id'])->where('user_id', $user_id)->where($data['model_fk'], $data['model_id_fk']);
|
||||
if ($chatDepartmentUserEntity->countAllResults() > 0) {
|
||||
return $this->response->setJSON(["message" => lang('Chat.subscribe_chat_wrong'), "status" => false]);
|
||||
} else {
|
||||
$this->chatDeparmentUserModel->insert(["chat_department_id" => $data["chat_department_id"], "user_id" => $user_id, $data['model_fk'] => $data['model_id_fk']]);
|
||||
return $this->response->setJSON(["message" => lang('Chat.subscribe_chat_ok'), "status" => true]);
|
||||
}
|
||||
}
|
||||
public function subscribe_admin_to_department()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
if ($data['user_id']) {
|
||||
|
||||
$this->chatDeparmentUserModel
|
||||
->insert(
|
||||
[
|
||||
"chat_department_id" => $data["chat_department_id"],
|
||||
"user_id" => $data["user_id"],
|
||||
]
|
||||
);
|
||||
return $this->response->setJSON(["message" => lang('Chat.subscribe_admin_chat_ok'), "status" => true]);
|
||||
} else {
|
||||
return $this->response->setStatusCode(422)->setJSON(["message" => lang('Chat.subscribe_admin_chat_wrong'), "status" => false]);
|
||||
}
|
||||
}
|
||||
public function config_view()
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => 'javascript:void(0);', 'active' => false],
|
||||
['title' => lang("App.menu_config_messages"), 'route' => route_to("configMessagesIndex"), 'active' => true]
|
||||
];
|
||||
|
||||
return view('themes/vuexy/form/configuracion/messages/configView', $this->viewData);
|
||||
}
|
||||
public function chat_department_edit($chat_department_id)
|
||||
{
|
||||
$chatDepartment = $this->chatDeparmentModel->find($chat_department_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => 'javascript:void(0);', 'active' => false],
|
||||
['title' => lang("App.menu_config_messages"), 'route' => route_to("configMessagesIndex"), 'active' => false],
|
||||
['title' => $chatDepartment->display, 'route' => route_to("chatDepartmentEditView", $chat_department_id), 'active' => true]
|
||||
|
||||
];
|
||||
$this->viewData["chat_department"] = $chatDepartment;
|
||||
return view('themes/vuexy/form/configuracion/messages/editChatDepartmentForm', $this->viewData);
|
||||
}
|
||||
public function chat_department_datatable()
|
||||
{
|
||||
$q = $this->chatDeparmentModel->datatableQuery();
|
||||
return DataTable::of($q)
|
||||
->add('action', fn($r) => $r->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function chat_department_user_datatable(int $chat_department_id)
|
||||
{
|
||||
$q = $this->chatDeparmentUserModel->datatableQuery($chat_department_id);
|
||||
$datatable = DataTable::of($q);
|
||||
if (auth()->user()->inGroup('admin')) {
|
||||
$datatable->add('action', fn($r) => $r->userId);
|
||||
}
|
||||
return $datatable->toJson(true);
|
||||
}
|
||||
public function select_users_not_in_chat_department(int $chat_department_id)
|
||||
{
|
||||
$paramQuery = $this->request->getGet("q");
|
||||
$data = $this->chatDeparmentUserModel->querySelectUsersNotInDepartment($chat_department_id, $paramQuery);
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function store_chat_department()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
$validated = $this->validation->run($data, 'chat_department');
|
||||
if ($validated) {
|
||||
$dataValidated = $this->validation->getValidated();
|
||||
$dataValidated['name'] = newUUID();
|
||||
$this->chatDeparmentModel->insert($dataValidated);
|
||||
return $this->response->setJSON(["message" => lang('App.global_alert_save_success'), "status" => true, "data" => $dataValidated]);
|
||||
} else {
|
||||
return $this->response->setStatusCode(422)->setJSON(["message" => lang('App.global_alert_save_success'), "status" => false, "errors" => $this->validation->getErrors()]);
|
||||
}
|
||||
return $this->response->setJSON(["message" => lang('App.global_alert_save_success'), "status" => true]);
|
||||
}
|
||||
public function update_chat_department(int $chat_department_id)
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
$validated = $this->validation->run($data, 'chat_department');
|
||||
if ($validated) {
|
||||
$dataValidated = $this->validation->getValidated();
|
||||
$this->chatDeparmentModel->update($chat_department_id, $dataValidated);
|
||||
return $this->response->setJSON(["message" => lang('App.global_alert_save_success'), "status" => true, "data" => $dataValidated]);
|
||||
} else {
|
||||
return $this->response->setStatusCode(422)->setJSON(["message" => lang('App.global_alert_save_success'), "status" => false, "errors" => $this->validation->getErrors()]);
|
||||
}
|
||||
}
|
||||
public function delete_chat_department($chat_department_id)
|
||||
{
|
||||
if (auth()->user()->inGroup('admin')) {
|
||||
$this->chatDeparmentModel->delete($chat_department_id);
|
||||
return $this->response->setJSON(["message" => lang('App.user_alert_delete'), "status" => true]);
|
||||
} else {
|
||||
return $this->response->setStatusCode(403)->setJSON(["message" => lang('App.user_alert_forbidden'), "status" => false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
|
||||
@ -152,7 +154,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -248,11 +250,20 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = ClienteModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource($searchValues);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = ClienteModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
foreach ($resourceData as $item) :
|
||||
if (isset($item->direccion) && strlen($item->direccion) > 100) :
|
||||
$item->direccion = character_limiter($item->direccion, 100);
|
||||
@ -271,7 +282,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
$this->model->getResource($searchValues)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -310,14 +321,9 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
try{
|
||||
try {
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
}
|
||||
catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$menu = [];
|
||||
}
|
||||
|
||||
@ -334,6 +340,28 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("clientes.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems($selId = null)
|
||||
{
|
||||
$paisModel = model('App\Models\Configuracion\PaisModel');
|
||||
@ -356,7 +384,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])];
|
||||
if (!is_null($selId)) :
|
||||
$userModel = model('App\Models\UserModel');
|
||||
$userModel = model('App\Models\Usuarios\UserModel');
|
||||
|
||||
$selOption = $userModel->where('id', $selId)->findColumn('first_name');
|
||||
if (!empty($selOption)) :
|
||||
@ -386,7 +414,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])];
|
||||
if (!is_null($selId)) :
|
||||
$userModel = model('App\Models\UserModel');
|
||||
$userModel = model('App\Models\Usuarios\UserModel');
|
||||
|
||||
$selOption = $userModel->where('id', $selId)->findColumn('last_name');
|
||||
if (!empty($selOption)) :
|
||||
@ -399,7 +427,7 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected function getFormaDePagoListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPagoes.formaDePago'))])];
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPago.formaDePago'))])];
|
||||
if (!empty($selId)) :
|
||||
$formaPagoModel = model('App\Models\Configuracion\FormaPagoModel');
|
||||
|
||||
@ -427,24 +455,23 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
protected function getPrecioTemplate($cliente_id){
|
||||
protected function getPrecioTemplate($cliente_id)
|
||||
{
|
||||
|
||||
$modelPreciosCliente = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$plantilla_id = $modelPreciosCliente->get_plantilla_precios($cliente_id);
|
||||
if (is_null($plantilla_id)){
|
||||
if (is_null($plantilla_id)) {
|
||||
return null;
|
||||
}
|
||||
$modelPlantillaPreciosCliente = model('App\Models\Clientes\ClientePlantillaPreciosModel');
|
||||
$plantilla = $modelPlantillaPreciosCliente->where("id", $plantilla_id)->where("is_deleted", 0)->first();
|
||||
if ($plantilla == false){
|
||||
$plantilla = $modelPlantillaPreciosCliente->where("id", $plantilla_id)->where("deleted_at", null)->first();
|
||||
if ($plantilla == false) {
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return (object)array(
|
||||
"value" => $plantilla_id,
|
||||
"label" => $plantilla->nombre
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
<?php
|
||||
namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -45,40 +46,36 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
public function update($requestedId = null)
|
||||
public function updatePlantilla()
|
||||
{
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$postData = $this->request->getJSON();
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$cliente_id = $postData['cliente_id'] ?? -1;
|
||||
$plantilla_id = $postData['plantilla_id'] ?? -1;
|
||||
|
||||
$plantilla_id = $postData->plantilla_id ?? -1;
|
||||
|
||||
// Se ha actualizado un registro por lo que no es una plantilla
|
||||
if($plantilla_id == -1){
|
||||
$this->model->clean_plantilla_id($requestedId);
|
||||
}
|
||||
else if($requestedId== -1){ // actualizar todos los clientes que usan una plantilla
|
||||
if ($plantilla_id == -1) {
|
||||
$this->model->clean_plantilla_id($cliente_id);
|
||||
} else if ($cliente_id == -1) { // actualizar todos los clientes que usan una plantilla
|
||||
$this->model->update_from_plantilla($plantilla_id);
|
||||
} else {
|
||||
$this->model->copy_from_plantilla($cliente_id, $plantilla_id);
|
||||
}
|
||||
else{
|
||||
$this->model->copy_from_plantilla($requestedId, $plantilla_id);
|
||||
}
|
||||
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -93,92 +90,113 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
|
||||
$requestedOrder2 = $reqData['order']['1']['column'] ?? $requestedOrder;
|
||||
$requestedOrder3 = $reqData['order']['2']['column'] ?? $requestedOrder;
|
||||
$requestedOrder4 = $reqData['order']['3']['column'] ?? $requestedOrder;
|
||||
$requestedOrder5 = $reqData['order']['4']['column'] ?? $requestedOrder;
|
||||
$order = ClientePreciosModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 0];
|
||||
$order2 = ClientePreciosModel::SORTABLE[$requestedOrder2 >= 0 ? $requestedOrder2 : $requestedOrder];
|
||||
$order3 = ClientePreciosModel::SORTABLE[$requestedOrder3 >= 0 ? $requestedOrder3 : $requestedOrder];
|
||||
$order4 = ClientePreciosModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder4 : $requestedOrder];
|
||||
$order5 = ClientePreciosModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder5 : $requestedOrder];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$dir2 = $reqData['order']['1']['dir'] ?? $dir;
|
||||
$dir3 = $reqData['order']['2']['dir'] ?? $dir;
|
||||
$dir4= $reqData['order']['3']['dir'] ?? $dir;
|
||||
$dir5= $reqData['order']['4']['dir'] ?? $dir;
|
||||
|
||||
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
|
||||
$cliente_id = $reqData['cliente_id'] ?? 0;
|
||||
|
||||
$resourceData = $this->model->getResource($cliente_id)
|
||||
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)->orderBy($order4, $dir4)->orderBy($order5, $dir5)
|
||||
->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource($searchValues, $cliente_id);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = ClientePreciosModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource($cliente_id)->countAllResults(),
|
||||
$this->model->getResource($cliente_id)->countAllResults()
|
||||
$this->model->getResource($searchValues, $cliente_id)->countAllResults(),
|
||||
$this->model->getResource($searchValues, $cliente_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable_editor() {
|
||||
public function datatable_editor()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
|
||||
|
||||
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst( $db, 'cliente_precios' )
|
||||
$response = Editor::inst($db, 'cliente_precios')
|
||||
->fields(
|
||||
Field::inst( 'plantilla_id' ),
|
||||
Field::inst( 'cliente_id' ),
|
||||
Field::inst( 'tipo' ),
|
||||
Field::inst( 'tipo_maquina' ),
|
||||
Field::inst( 'tipo_impresion' ),
|
||||
Field::inst( 'user_updated_id' ),
|
||||
Field::inst( 'updated_at' ),
|
||||
Field::inst( 'is_deleted' ),
|
||||
Field::inst( 'tiempo_min' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
Field::inst('plantilla_id'),
|
||||
Field::inst('cliente_id'),
|
||||
Field::inst('tipo'),
|
||||
Field::inst('tipo_maquina'),
|
||||
Field::inst('tipo_impresion'),
|
||||
Field::inst('user_updated_id'),
|
||||
Field::inst('updated_at'),
|
||||
Field::inst('tiempo_min')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
)
|
||||
->validator('Validate::numeric', array(
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
),
|
||||
|
||||
Field::inst( 'tiempo_max' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
|
||||
Field::inst('tiempo_max')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
)
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
),
|
||||
|
||||
Field::inst( 'precio_hora' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
)
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
),
|
||||
|
||||
Field::inst( 'margen' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
)
|
||||
->validator('Validate::numeric', array(
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
),
|
||||
|
||||
Field::inst('precio_hora')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
),
|
||||
|
||||
Field::inst('margen')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
),
|
||||
|
||||
)
|
||||
@ -186,7 +204,6 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
|
||||
foreach ($data['data'] as $pkey => $values) {
|
||||
// Si no se quiere borrar...
|
||||
if ($data['data'][$pkey]['is_deleted'] != 1) {
|
||||
$process_data['tiempo_min'] = $data['data'][$pkey]['tiempo_min'];
|
||||
$process_data['tiempo_max'] = $data['data'][$pkey]['tiempo_max'];
|
||||
$process_data['tipo'] = $data['data'][$pkey]['tipo'];
|
||||
@ -198,26 +215,23 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
if (!empty($response)) {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->on('preCreate', function ($editor, &$values) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue($session->id_user);
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
})
|
||||
->on('preEdit', function ($editor, &$values) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue($session->id_user);
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
@ -238,4 +252,16 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function getCurrentPlantilla()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$cliente_id = $this->request->getGet('cliente_id');
|
||||
$plantilla = $this->model->getPlantilla($cliente_id);
|
||||
return $this->respond($plantilla);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Clientes;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
@ -6,6 +8,8 @@ use App\Entities\Clientes\ClienteDireccionesEntity;
|
||||
|
||||
use App\Models\Clientes\ClienteDireccionesModel;
|
||||
|
||||
use App\Models\Usuarios\UserModel;
|
||||
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
@ -22,21 +26,69 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected static $controllerSlug = 'clientedirecciones';
|
||||
|
||||
public function add(){
|
||||
protected static $viewPath = 'themes/vuexy/form/clientes/direcciones/';
|
||||
|
||||
protected $indexRoute = 'clienteDireccionesList';
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Clientes.direccionesEnvio');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
$this->viewData = ['usingServerSideDataTable' => true]; // JJO
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Clientes.direccionesEnvio"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
|
||||
];
|
||||
|
||||
$this->viewData['comunidadAutonomaList'] = $this->getComunidadAutonomaListItems($clienteEntity->comunidad_autonoma_id ?? null);
|
||||
$this->viewData['provinciaList'] = $this->getProvinciaListItems($clienteEntity->provincia_id ?? null);
|
||||
$this->viewData['paisList'] = $this->getPaisListItems($clienteEntity->pais_id ?? null);
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$id = auth()->user()->id;
|
||||
$user_model = new UserModel();
|
||||
$user = $user_model->find($id);
|
||||
$cliente_id = $user->cliente_id;
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Clientes.cliente')]),
|
||||
'cliente_id' => $cliente_id,
|
||||
"user_id" => $id,
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . 'viewClienteDireccionesList', $viewData);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$cliente_id = $reqData['cliente_id'] ?? -1;
|
||||
$att = $reqData['att'] ?? "";
|
||||
$email = $reqData['email'] ?? "";
|
||||
$direccion = $reqData['direccion'] ?? "";
|
||||
$pais_id = $reqData['paisId'] ?? -1;
|
||||
$pais_id = $reqData['pais_id'] ?? -1;
|
||||
$provincia = $reqData['provincia'] ?? "";
|
||||
$municipio = $reqData['municipio'] ?? "";
|
||||
$cp = $reqData['cp'] ?? "";
|
||||
$telefono = $reqData['telefono'] ?? "";
|
||||
$alias = $reqData['alias'] ?? "";
|
||||
|
||||
|
||||
$data = [
|
||||
"cliente_id" => $cliente_id,
|
||||
"att" => $att,
|
||||
@ -50,15 +102,11 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
"alias" => $alias,
|
||||
];
|
||||
$response = $this->model->insert($data);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$data_ret = [
|
||||
'data' => $response,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data_ret);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
@ -68,14 +116,14 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$cliente_id = $reqData['cliente_id'] ?? -1;
|
||||
|
||||
|
||||
$clienteDireccionesModel = model('App\Models\Clientes\ClienteDireccionesModel');
|
||||
$menu = $clienteDireccionesModel->getMenuDirecciones($cliente_id);
|
||||
//$menu = $this->model->getMenuItems($cliente_id);
|
||||
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
@ -89,6 +137,34 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$cliente_id = $this->request->getGet('cliente_id');
|
||||
|
||||
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"alias as name"
|
||||
]
|
||||
)
|
||||
->where("cliente_id", $cliente_id)
|
||||
->orderBy("alias", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("clientes.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
@ -96,7 +172,7 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
|
||||
$tipo = $reqData['tipo'] ?? null;
|
||||
|
||||
if(is_null($tipo)){
|
||||
if (is_null($tipo)) {
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
@ -111,22 +187,21 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
|
||||
$id_C = $reqData['cliente_id'] ?? -1;
|
||||
|
||||
|
||||
|
||||
$resourceData = $this->model->getResource($search, $id_C)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource("", $id_C)->countAllResults()
|
||||
));
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
|
||||
$id = $reqData['id'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getDireccion($id);
|
||||
|
||||
|
||||
|
||||
return $this->respond($resourceData);
|
||||
}
|
||||
@ -135,6 +210,48 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function get($id)
|
||||
{
|
||||
try {
|
||||
$resourceData = $this->model->getDireccion($id);
|
||||
$response = (object)[
|
||||
'error' => false,
|
||||
'data' => $resourceData
|
||||
];
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $e) {
|
||||
$response = (object)[
|
||||
'error' => true,
|
||||
'message' => $e->getMessage()
|
||||
];
|
||||
return $this->fail($response);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDireccionPresupuesto($id)
|
||||
{
|
||||
try {
|
||||
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||
$resourceData = $model->getDireccion($id);
|
||||
if(count($resourceData) > 0){
|
||||
$resourceData[0]->direccionId = $id;
|
||||
}
|
||||
|
||||
$response = (object)[
|
||||
'error' => false,
|
||||
'data' => $resourceData
|
||||
];
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $e) {
|
||||
$response = (object)[
|
||||
'error' => true,
|
||||
'message' => $e->getMessage()
|
||||
];
|
||||
return $this->fail($response);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable_editor()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
@ -145,72 +262,116 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
$response = Editor::inst($db, 'cliente_direcciones')
|
||||
->fields(
|
||||
Field::inst('att')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)
|
||||
)
|
||||
->validator( Validate::maxLen( 100 ) , array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length'))
|
||||
),
|
||||
->validator(
|
||||
Validate::maxLen(100),
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length')
|
||||
)
|
||||
),
|
||||
Field::inst('alias')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)
|
||||
)
|
||||
->validator( Validate::maxLen( 100 ) , array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length'))
|
||||
),
|
||||
->validator(
|
||||
Validate::maxLen(100),
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length')
|
||||
)
|
||||
),
|
||||
Field::inst('email')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)
|
||||
)
|
||||
->validator( Validate::maxLen( 100 ) , array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length'))
|
||||
),
|
||||
->validator(
|
||||
Validate::maxLen(100),
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length')
|
||||
)
|
||||
),
|
||||
Field::inst('direccion')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)
|
||||
)
|
||||
->validator( Validate::maxLen( 255 ) , array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length'))
|
||||
),
|
||||
->validator(
|
||||
Validate::maxLen(255),
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length')
|
||||
)
|
||||
),
|
||||
Field::inst('municipio')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)
|
||||
)
|
||||
->validator( Validate::maxLen( 100 ) , array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length'))
|
||||
),
|
||||
->validator(
|
||||
Validate::maxLen(100),
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length')
|
||||
)
|
||||
),
|
||||
Field::inst('cp')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)
|
||||
)
|
||||
->validator( Validate::maxLen( 20 ) , array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length'))
|
||||
),
|
||||
->validator(
|
||||
Validate::maxLen(20),
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length')
|
||||
)
|
||||
),
|
||||
Field::inst('telefono')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)
|
||||
)
|
||||
->validator( Validate::maxLen( 40 ) , array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length'))
|
||||
),
|
||||
->validator(
|
||||
Validate::maxLen(40),
|
||||
array(
|
||||
'message' => lang('ClienteDirecciones.validation.max_length')
|
||||
)
|
||||
),
|
||||
Field::inst('provincia')
|
||||
->validator( function ( $val, $data, $field, $host ) {
|
||||
if ($data['pais_id'] == 1) { // Si es españa provincia y CCAA es obligatorio
|
||||
if (strlen( $val ) > 100)
|
||||
return lang('ClienteDirecciones.validation.max_length');
|
||||
else if (strlen( $val ) == 0)
|
||||
lang('ClienteDirecciones.validation.required');
|
||||
else
|
||||
return true;
|
||||
->validator(
|
||||
function ($val, $data, $field, $host) {
|
||||
if ($data['pais_id'] == 1) { // Si es españa provincia y CCAA es obligatorio
|
||||
if (strlen($val) > 100)
|
||||
return lang('ClienteDirecciones.validation.max_length');
|
||||
else if (strlen($val) == 0)
|
||||
lang('ClienteDirecciones.validation.required');
|
||||
else
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
),
|
||||
),
|
||||
Field::inst('pais_id')->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))),
|
||||
'message' => lang('ClienteDirecciones.validation.required')
|
||||
)),
|
||||
Field::inst('cliente_id'),
|
||||
)
|
||||
|
||||
|
||||
->debug(true)
|
||||
->process($_POST)
|
||||
->data();
|
||||
@ -221,9 +382,46 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
$response[$csrfTokenName] = $newTokenHash;
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems($selId = null)
|
||||
{
|
||||
$paisModel = model('App\Models\Configuracion\PaisModel');
|
||||
$onlyActiveOnes = true;
|
||||
$data = $paisModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getComunidadAutonomaListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])];
|
||||
if (!is_null($selId)) :
|
||||
$comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel');
|
||||
|
||||
$selOption = $comunidadAutonomaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getProvinciaListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])];
|
||||
if (!empty($selId)) :
|
||||
$provinciaModel = model('App\Models\Configuracion\ProvinciaModel');
|
||||
|
||||
$selOption = $provinciaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
<?php
|
||||
namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -42,7 +43,7 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_clientes"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_plantillas_tarifas_clientes"), 'route' => site_url('clientes/clienteplantillaprecios'), 'active' => true]
|
||||
['title' => lang("App.menu_plantillas_tarifas_clientes"), 'route' => route_to("clienteplantillapreciosList"), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -70,51 +71,48 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
// plantilla desde la lista
|
||||
public function update($requestedId = null)
|
||||
{
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
$model = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$model->delete_values($requestedId);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
if ($requestedId == null):
|
||||
return;
|
||||
endif;
|
||||
$model = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$model->delete_values($requestedId);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$cliente_id = $postData['cliente_id'] ?? -1;
|
||||
|
||||
$from_client_data = $postData['from_client_data'] ?? 0;
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_created_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -126,26 +124,29 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
if ($from_client_data == 1) {
|
||||
$thenRedirect = false;
|
||||
} else {
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
}
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if($cliente_id != -1){
|
||||
if ($cliente_id != -1) {
|
||||
$modelLineas = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$modelLineas->copy_from_cliente($cliente_id, $id);
|
||||
$modelClientePrecios = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$modelClientePrecios->set_plantilla_id($cliente_id, $id);
|
||||
return ;
|
||||
}
|
||||
else{
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return $this->respond(['status' => 'success', 'id' => $id]);
|
||||
} else {
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('/clientes/clienteplantillaprecios/edit/' . $id))->with('message', $message);
|
||||
return redirect()->to(site_url('/clienteplantillaprecios/edit/' . $id))->with('message', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
@ -171,35 +172,35 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$clientePlantillaPreciosEntity = $this->model->find($id);
|
||||
|
||||
if ($clientePlantillaPreciosEntity == false) :
|
||||
if ($clientePlantillaPreciosEntity == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Clientes.cliente')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -216,12 +217,12 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $clientePlantillaPreciosEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -236,7 +237,7 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
//var_dump($clientePlantillaPreciosEntity); dd();
|
||||
|
||||
$this->viewData['clienteplantillapreciosEntity'] = $clientePlantillaPreciosEntity;
|
||||
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateClienteplantillaprecios', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Clientes.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
@ -246,6 +247,23 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function updatePlantillaEnCliente(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$plantilla_id = $reqData['plantilla_id'] ?? -1;
|
||||
|
||||
$model = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$model->update_plantilla_id($plantilla_id);
|
||||
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
@ -257,16 +275,16 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = ClientePlantillaPreciosModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 0];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource($searchValues)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
$this->model->getResource($searchValues)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -275,34 +293,32 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
try{
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr, true);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
}
|
||||
catch(Exception $e){
|
||||
$menu = [];
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where("deleted_at", null);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("cliente_plantilla_precios.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
$items = $query->get()->getResultObject();
|
||||
// add a custom item at the beginning
|
||||
$customItem = new \stdClass;
|
||||
$customItem->id = 0;
|
||||
$customItem->name = "Personalizado";
|
||||
array_unshift($items, $customItem);
|
||||
|
||||
return $this->response->setJSON($items);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -93,31 +93,47 @@ class Clienteplantillaprecioslineas extends \App\Controllers\BaseResourceControl
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
|
||||
$requestedOrder2 = $reqData['order']['1']['column'] ?? $requestedOrder;
|
||||
$requestedOrder3 = $reqData['order']['2']['column'] ?? $requestedOrder;
|
||||
$requestedOrder4 = $reqData['order']['3']['column'] ?? $requestedOrder;
|
||||
$requestedOrder5 = $reqData['order']['4']['column'] ?? $requestedOrder;
|
||||
$order = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 0];
|
||||
$order2 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder2 >= 0 ? $requestedOrder2 : $requestedOrder];
|
||||
$order3 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder3 >= 0 ? $requestedOrder3 : $requestedOrder];
|
||||
$order4 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder4 : $requestedOrder];
|
||||
$order5 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder5 : $requestedOrder];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$dir2 = $reqData['order']['1']['dir'] ?? $dir;
|
||||
$dir3 = $reqData['order']['2']['dir'] ?? $dir;
|
||||
$dir4= $reqData['order']['3']['dir'] ?? $dir;
|
||||
$dir5= $reqData['order']['4']['dir'] ?? $dir;
|
||||
|
||||
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
|
||||
$plantilla_id = $reqData['plantilla_id'] ?? 0;
|
||||
|
||||
$resourceData = $this->model->getResource($plantilla_id)
|
||||
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)->orderBy($order4, $dir4)->orderBy($order5, $dir5)
|
||||
->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource($searchValues, $plantilla_id);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = ClientePlantillaPreciosLineasModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource($plantilla_id)->countAllResults(),
|
||||
$this->model->getResource($plantilla_id)->countAllResults()
|
||||
$this->model->getResource([], $plantilla_id)->countAllResults(),
|
||||
$this->model->getResource($searchValues, $plantilla_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getStoredRows()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
$plantilla_id = $reqData['plantilla_id'] ?? 0;
|
||||
|
||||
$resourceData = $this->model->getResource([], $plantilla_id);
|
||||
$resourceData = $resourceData->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource([], $plantilla_id)->countAllResults(),
|
||||
$this->model->getResource([], $plantilla_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -180,42 +196,21 @@ class Clienteplantillaprecioslineas extends \App\Controllers\BaseResourceControl
|
||||
),
|
||||
|
||||
)
|
||||
->validator(function ($editor, $action, $data) {
|
||||
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT) {
|
||||
foreach ($data['data'] as $pkey => $values) {
|
||||
// Si no se quiere borrar...
|
||||
if ($data['data'][$pkey]['is_deleted'] != 1) {
|
||||
$process_data['tiempo_min'] = $data['data'][$pkey]['tiempo_min'];
|
||||
$process_data['tiempo_max'] = $data['data'][$pkey]['tiempo_max'];
|
||||
$process_data['tipo'] = $data['data'][$pkey]['tipo'];
|
||||
$process_data['tipo_maquina'] = $data['data'][$pkey]['tipo_maquina'];
|
||||
$process_data['tipo_impresion'] = $data['data'][$pkey]['tipo_impresion'];
|
||||
|
||||
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['plantilla_id']);
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if (!empty($response)) {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
->on('preCreate', function ($editor, &$values) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue($session->id_user);
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
})
|
||||
->on('preEdit', function ($editor, &$values) {
|
||||
$session = session();
|
||||
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue($session->id_user);
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
|
||||
73
ci4/app/Controllers/Clientes/Clienteusuarios.php
Normal file → Executable file
73
ci4/app/Controllers/Clientes/Clienteusuarios.php
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
<?php
|
||||
namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -40,6 +41,59 @@ class Clienteusuarios extends \App\Controllers\BaseResourceController
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
public function removeClienteFromUser($user_id)
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
if (intval($user_id) > 0) {
|
||||
$this->model->removeClienteFromUser($user_id);
|
||||
return $this->respond(['status' => 'success', 'msg' => 'Usuario eliminado correctamente']);
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function addUserToClient(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$user_id = $this->request->getPost("user_id");
|
||||
$cliente_id = $this->request->getPost("cliente_id");
|
||||
if (intval($user_id) > 0 && intval($cliente_id) > 0) {
|
||||
$this->model->addUserToClient($user_id, $cliente_id);
|
||||
return $this->respond(['status' => 'success', 'msg' => 'Usuario añadido correctamente']);
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAvailableUsers()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"CONCAT(first_name, ' ', last_name) as name"
|
||||
]
|
||||
)
|
||||
->where("deleted_at", null)
|
||||
->where("cliente_id", null);
|
||||
|
||||
if ($this->request->getGet("q")) {
|
||||
$column = "CONCAT(first_name, ' ', last_name)";
|
||||
$value = $this->request->getGet("q");
|
||||
$query->groupStart()
|
||||
->where("LOWER(CONVERT($column USING utf8)) COLLATE utf8_general_ci LIKE", "%" . strtolower($value) . "%")
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
$items = $query->get()->getResultObject();
|
||||
return $this->response->setJSON($items);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
@ -53,14 +107,19 @@ class Clienteusuarios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = ClienteUsuariosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
$id_C = $reqData['id_cliente'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getResource("", $id_C)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource("", $id_C);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = ClienteUsuariosModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
|
||||
@ -50,6 +50,8 @@ class Proveedores extends \App\Controllers\BaseResourceController {
|
||||
|
||||
|
||||
public function index() {
|
||||
|
||||
checkPermission('proveedores.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -67,9 +69,7 @@ class Proveedores extends \App\Controllers\BaseResourceController {
|
||||
|
||||
public function add() {
|
||||
|
||||
|
||||
|
||||
|
||||
checkPermission('proveedores.create');
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -138,6 +138,8 @@ class Proveedores extends \App\Controllers\BaseResourceController {
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null) {
|
||||
|
||||
checkPermission('proveedores.edit');
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
@ -381,4 +383,26 @@ class Proveedores extends \App\Controllers\BaseResourceController {
|
||||
}
|
||||
}
|
||||
|
||||
public function getForSelect(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$tipo_id = $this->request->getGet("tipo_id");
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->where('tipo_id', $tipo_id)->where('deleted_at', null)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_proveedores.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -271,6 +271,27 @@ class Comunidadesautonomas extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_comunidades_autonomas.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems($selId = null)
|
||||
{
|
||||
|
||||
81
ci4/app/Controllers/Configuracion/ConfigErrores.php
Executable file
81
ci4/app/Controllers/Configuracion/ConfigErrores.php
Executable file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Models\Collection;
|
||||
use App\Models\Presupuestos\ErrorPresupuesto as ErrorPresupuestoModel;
|
||||
use CodeIgniter\HTTP\Response;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
|
||||
class ConfigErrores extends BaseResourceController
|
||||
{
|
||||
|
||||
protected ErrorPresupuestoModel $errorPresupuestoModel;
|
||||
protected $format = 'json';
|
||||
protected array $viewData = [];
|
||||
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/error_presupuesto/';
|
||||
protected static $controllerSlug = "errores-presupuesto";
|
||||
protected $indexRoute = 'viewErrorPresupuestoList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->errorPresupuestoModel = model(ErrorPresupuestoModel::class);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_error_presupuesto"), 'route' => site_url('configuracion/errores-presupuesto'), 'active' => true]
|
||||
];
|
||||
return view(static::$viewPath . $this->indexRoute, $this->viewData);
|
||||
}
|
||||
public function viewForm(int $error_presupuesto_id)
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_error_presupuesto"), 'route' => site_url('configuracion/errores-presupuesto'), 'active' => true]
|
||||
];
|
||||
$this->viewData["error_presupuesto_id"] = $error_presupuesto_id;
|
||||
$this->errorPresupuestoModel->update($error_presupuesto_id, [
|
||||
"last_user_id" => auth()->user()->id,
|
||||
"visto" => true,
|
||||
]);
|
||||
return view(static::$viewPath . 'viewErrorPresupuestoForm', $this->viewData);
|
||||
}
|
||||
public function store()
|
||||
{
|
||||
$data = [];
|
||||
$variableCreated = $this->errorPresupuestoModel->store($data);
|
||||
return $this->response->setJSON($variableCreated);
|
||||
}
|
||||
public function get_error_presupuesto(int $error_presupuesto_id)
|
||||
{
|
||||
$data = $this->errorPresupuestoModel->getErrorPresupuestoForm($error_presupuesto_id);
|
||||
if (isset($data[0])) {
|
||||
return $this->response->setJSON(["data" => $data[0]]);
|
||||
} else {
|
||||
return $this->response->setJSON(["data" => []]);
|
||||
}
|
||||
}
|
||||
public function update_error_presupuesto(int $error_presupuesto_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$this->errorPresupuestoModel->updateComment($error_presupuesto_id, $bodyData["comments"]);
|
||||
return $this->response->setJSON(["message" => "Comentario actualizado", "status" => true]);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
$query = $this->errorPresupuestoModel->getQueryDatatable()->orderBy("created_at", "DESC");
|
||||
return DataTable::of($query)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
}
|
||||
92
ci4/app/Controllers/Configuracion/ConfigVariables.php
Executable file
92
ci4/app/Controllers/Configuracion/ConfigVariables.php
Executable file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Models\Collection;
|
||||
use App\Models\Configuracion\ConfigVariableModel;
|
||||
use CodeIgniter\HTTP\Response;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
|
||||
class ConfigVariables extends BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = ConfigVariableModel::class;
|
||||
protected ConfigVariableModel $configVariableModel;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Variables';
|
||||
protected static $singularObjectNameCc = 'variables';
|
||||
protected static $pluralObjectName = 'Variables';
|
||||
protected static $pluralObjectNameCc = 'variables';
|
||||
|
||||
protected static $controllerSlug = 'variables';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/variables/';
|
||||
|
||||
protected $indexRoute = 'viewVariablesList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->configVariableModel = model(ConfigVariableModel::class);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . $this->indexRoute, $viewData);
|
||||
}
|
||||
public function store()
|
||||
{
|
||||
$data = [];
|
||||
$variableCreated = $this->configVariableModel->store($data);
|
||||
return $this->response->setJSON($variableCreated);
|
||||
}
|
||||
public function get(int $config_variable_id)
|
||||
{
|
||||
$data = $this->configVariableModel->find($config_variable_id);
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function updateVariable(int $config_variable_id)
|
||||
{
|
||||
$reqData = [];
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
$status = $this->configVariableModel->update($config_variable_id, $reqData);
|
||||
return $this->response->setJSON([
|
||||
"message" => "Variable actualizada correctamente",
|
||||
"status" => $status
|
||||
]);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
public function deleteVariable(int $config_variable_id): Response
|
||||
{
|
||||
return $this->response->setJSON([]);
|
||||
}
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
$query = $this->configVariableModel->builder()->select([
|
||||
"id",
|
||||
"name",
|
||||
"value",
|
||||
"description"
|
||||
])->orderBy("name", "asc");
|
||||
return DataTable::of($query)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
}
|
||||
103
ci4/app/Controllers/Configuracion/FestivoController.php
Normal file
103
ci4/app/Controllers/Configuracion/FestivoController.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Entities\Configuracion\FestivoEntity;
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Configuracion\Imposicion;
|
||||
use App\Models\Configuracion\FestivoModel;
|
||||
use App\Models\Configuracion\ImposicionEsquemaModel;
|
||||
use App\Models\Configuracion\ImposicionModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class FestivoController extends BaseController
|
||||
{
|
||||
|
||||
protected $modelName = FestivoModel::class;
|
||||
protected FestivoModel $model;
|
||||
protected static $controllerSlug = 'festivos';
|
||||
protected $format = 'json';
|
||||
|
||||
protected string $viewPath = 'themes/vuexy/form/configuracion/festivos/';
|
||||
|
||||
protected $indexRoute = 'festivoList';
|
||||
protected array $viewData = [];
|
||||
protected Validation $validation;
|
||||
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Festivos.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
$this->model = model($this->modelName);
|
||||
$this->validation = service("validation");
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view($this->viewPath . $this->indexRoute);
|
||||
}
|
||||
|
||||
public function store_festivo_date()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$date = $bodyData['date'];
|
||||
$count = $this->model->where('date',$date)->countAllResults();
|
||||
if ($count) {
|
||||
$status = $this->model->where('date', $date)->delete(purge: true);
|
||||
return $this->response->setJSON([
|
||||
"message" => lang("App.user_alert_delete"),
|
||||
"status" => $status,
|
||||
]);
|
||||
} else {
|
||||
|
||||
$status = $this->model->insert($bodyData);
|
||||
if ($status) {
|
||||
$festivoEntity = $this->model->find($status);
|
||||
return $this->response->setJSON([
|
||||
"message" => lang("App.global_alert_save_success"),
|
||||
"status" => $status,
|
||||
"data" => $festivoEntity
|
||||
]);
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
"message" => lang("App.global_alert_save_error"),
|
||||
"errors" => $this->model->errors(),
|
||||
"status" => true
|
||||
])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
public function delete_festivo_date($id)
|
||||
{
|
||||
$status = $this->model->delete($id, true);
|
||||
if ($status) {
|
||||
return $this->response->setJSON([
|
||||
"message" => lang("App.user_alert_delete"),
|
||||
"status" => $status,
|
||||
]);
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
"message" => lang("App.global_alert_save_error"),
|
||||
"errors" => $this->model->errors(),
|
||||
"status" => true
|
||||
])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function find_all()
|
||||
{
|
||||
$festivos = $this->model->findAll();
|
||||
return $this->response->setJSON([
|
||||
"message" => lang("App.global_alert_fetch_success"),
|
||||
"status" => true,
|
||||
"data" => $festivos
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -9,7 +9,7 @@ use App\Entities\Configuracion\FormaPagoEntity;
|
||||
|
||||
use App\Models\Configuracion\FormaPagoModel;
|
||||
|
||||
class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
class FormasPago extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = FormaPagoModel::class;
|
||||
@ -22,15 +22,22 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected static $controllerSlug = 'formas-pagos';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/formasPagoViews/';
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/formas-pago/';
|
||||
|
||||
protected $indexRoute = 'formaDePagoList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle');
|
||||
$this->viewData['pageTitle'] = lang('FormasPago.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_formas_pago"), 'route' => route_to('formasPagoList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
@ -40,7 +47,7 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('FormasPagoes.formaDePago')]),
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('FormasPago.formaDePago')]),
|
||||
'formaPagoEntity' => new FormaPagoEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
@ -55,22 +62,15 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
@ -93,7 +93,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('/configuracion/formas-pago/edit/' . $id))->with('sweet-success', $message);
|
||||
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
@ -106,11 +107,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['formaPagoEntity'] = isset($sanitizedData) ? new FormaPagoEntity($sanitizedData) : new FormaPagoEntity();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createFormaDePago');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPagoes.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
$this->viewData['formAction'] = route_to('formasPagoAdd');
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPago.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
@ -125,25 +123,18 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
$formaPagoEntity = $this->model->find($id);
|
||||
|
||||
if ($formaPagoEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPagoes.formaDePago')), $id]);
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPago.formaDePago')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
@ -152,13 +143,12 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPagoes.formaDePago'))]);
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPago.formaDePago'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$formaPagoEntity->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
@ -179,11 +169,8 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['formaPagoEntity'] = $formaPagoEntity;
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateFormaDePago', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPagoes.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
$this->viewData['formAction'] = route_to('formasPagoEdit', $id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPago.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
@ -243,25 +230,19 @@ class Formaspagos extends \App\Controllers\BaseResourceController
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("formas_pago.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
@ -28,7 +28,7 @@ class Group extends \App\Controllers\GoBaseController
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => "Home", 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_permission_group"), 'route' => site_url("configuracion/group"), 'active' => true]
|
||||
['title' => lang("App.menu_permission_group"), 'route' => route_to("userGroupList"), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
|
||||
@ -1,36 +1,42 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Controllers\BaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Configuracion\Imposicion;
|
||||
|
||||
use App\Models\Configuracion\ImposicionEsquemaModel;
|
||||
use App\Models\Configuracion\ImposicionModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Imposiciones extends \App\Controllers\BaseResourceController
|
||||
class Imposiciones extends BaseController
|
||||
{
|
||||
|
||||
protected $modelName = ImposicionModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Imposicion';
|
||||
protected static $singularObjectNameCc = 'imposicion';
|
||||
protected static $pluralObjectName = 'Imposiciones';
|
||||
protected static $pluralObjectNameCc = 'imposiciones';
|
||||
|
||||
protected ImposicionModel $model;
|
||||
protected ImposicionEsquemaModel $imposicionEsquemaModel;
|
||||
protected static $controllerSlug = 'imposiciones';
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/imposiciones/';
|
||||
|
||||
protected $indexRoute = 'imposicionList';
|
||||
protected array $viewData = [];
|
||||
protected Validation $validation;
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Imposiciones.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
$this->model = model($this->modelName);
|
||||
$this->validation = service("validation");
|
||||
$this->imposicionEsquemaModel = model(ImposicionEsquemaModel::class);
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
@ -45,7 +51,10 @@ class Imposiciones extends \App\Controllers\BaseResourceController
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_imposiciones"), 'route' => route_to("imposicionList"), 'active' => true],
|
||||
|
||||
];
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . 'viewImposicionList', $viewData);
|
||||
@ -54,231 +63,155 @@ class Imposiciones extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_imposiciones"), 'route' => route_to("imposicionList"), 'active' => true],
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['imposicion'] = isset($sanitizedData) ? new Imposicion($sanitizedData) : new Imposicion();
|
||||
$this->viewData['orientacionList'] = $this->getOrientacionOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createImposicion');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Imposiciones.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null)
|
||||
];
|
||||
$this->viewData["method"] = "add";
|
||||
return view(static::$viewPath . 'viewImposicionNewForm', $this->viewData);
|
||||
}
|
||||
public function add_esquema()
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_imposiciones"), 'route' => route_to("imposicionList"), 'active' => true],
|
||||
];
|
||||
$this->viewData["imposicion_esquema"] = null;
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$imposicion = $this->model->find($id);
|
||||
return view(static::$viewPath . 'viewImposicionEsquemaForm', $this->viewData);
|
||||
}
|
||||
public function edit($imposicion_id = null)
|
||||
{
|
||||
if ($imposicion_id) {
|
||||
$this->viewData["imposicion"] = $this->model->find($imposicion_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_imposiciones"), 'route' => route_to("imposicionList"), 'active' => false],
|
||||
['title' => $this->viewData["imposicion"]->full_name, 'route' => route_to("updateImposicionForm", $imposicion_id), 'active' => true],
|
||||
|
||||
if ($imposicion == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Imposiciones.imposicion')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
];
|
||||
}
|
||||
$this->viewData["method"] = "edit";
|
||||
return view(static::$viewPath . 'viewImposicionForm', $this->viewData);
|
||||
}
|
||||
public function edit_imposicion_esquema($imposicion_esquema_id = null)
|
||||
{
|
||||
if ($imposicion_esquema_id) {
|
||||
$this->viewData["imposicion_esquema"] = $this->imposicionEsquemaModel->find($imposicion_esquema_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_imposiciones"), 'route' => route_to("imposicionList"), 'active' => false],
|
||||
['title' => $this->viewData["imposicion_esquema"]->name, 'route' => route_to("updateImposicionEsquemaForm", $imposicion_esquema_id), 'active' => true],
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Imposiciones.imposicion'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$imposicion->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $imposicion->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['imposicion'] = $imposicion;
|
||||
$this->viewData['orientacionList'] = $this->getOrientacionOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateImposicion', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Imposiciones.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
];
|
||||
}
|
||||
return view(static::$viewPath . 'viewImposicionEsquemaForm', $this->viewData);
|
||||
}
|
||||
public function update($imposicion_id = null)
|
||||
{
|
||||
if ($imposicion_id) {
|
||||
$bodyData = $this->request->getPost();
|
||||
if(isset($bodyData["imposicion_esquema_id"])){
|
||||
if($bodyData["imposicion_esquema_id"] == ""){
|
||||
$bodyData["imposicion_esquema_id"] = null;
|
||||
}
|
||||
}
|
||||
$status = $this->model->update($imposicion_id, $bodyData);
|
||||
if ($status) {
|
||||
$imposicionEntity = $this->model->find($imposicion_id);
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_error"), "errors" => $this->model->errors(), "status" => true])->setStatusCode(400);
|
||||
}
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status, "data" => $imposicionEntity]);
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_error"), "message" => "", "status" => false])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function update_imposicion_esquema($imposicion_esquema_id = null)
|
||||
{
|
||||
if ($imposicion_esquema_id) {
|
||||
$bodyData = $this->request->getPost();
|
||||
$status = $this->imposicionEsquemaModel->update($imposicion_esquema_id, $bodyData);
|
||||
if ($status) {
|
||||
$imposicionEsquemaEntity = $this->imposicionEsquemaModel->find($imposicion_esquema_id);
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_error"), "errors" => $this->imposicionEsquemaModel->errors(), "status" => true])->setStatusCode(400);
|
||||
}
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status, "data" => $imposicionEsquemaEntity]);
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_error"), "message" => "", "status" => false])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function delete($imposicion_id = null)
|
||||
{
|
||||
$status = $this->model->delete($imposicion_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => true]);
|
||||
}
|
||||
public function delete_imposicion_esquema($imposicion_esquema_id = null)
|
||||
{
|
||||
$status = $this->imposicionEsquemaModel->delete($imposicion_esquema_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => $status]);
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = ImposicionModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$q = $this->model->queryDatatable();
|
||||
return DataTable::of($q)
|
||||
->add('esquema', fn($q) => ["imposicionId" => $q->id,"esquemaId" => $q->esquemaId, "esquemaName" => $q->esquemaName])
|
||||
->add(
|
||||
'action',
|
||||
fn($q) => "<div class='btn-group btn-group-md gap-2 w-100 d-flex justify-space-between'>" . ImposicionModel::datatable_buttons($q->id) . "</div>"
|
||||
)
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_imposicion_esquema()
|
||||
{
|
||||
$q = $this->imposicionEsquemaModel->queryDatatable();
|
||||
return DataTable::of($q)
|
||||
->add(
|
||||
'action',
|
||||
fn($q) => "<div class='btn-group btn-group-md gap-2'>" . ImposicionEsquemaModel::datatable_buttons($q->id) . "</div>"
|
||||
)
|
||||
->toJson(true);
|
||||
}
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
public function selectImposicion()
|
||||
{
|
||||
$data = $this->model->querySelect($this->request->getGet('q'));
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function selectImposicionEsquema()
|
||||
{
|
||||
$data = $this->imposicionEsquemaModel->querySelect($this->request->getGet('q'));
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function find_imposicion(int $imposicion_id)
|
||||
{
|
||||
$imposicionEntity = $this->model->find($imposicion_id)->withImposicionEsquema();
|
||||
return $this->response->setJSON($imposicionEntity);
|
||||
}
|
||||
public function find_imposicion_esquema(int $imposicion_esquema_id)
|
||||
{
|
||||
$imposicionEsquemaEntity = $this->imposicionEsquemaModel->find($imposicion_esquema_id);
|
||||
return $this->response->setJSON($imposicionEsquemaEntity);
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$createdId = $this->model->insert($bodyData);
|
||||
if ($createdId) {
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true]);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_error"), "errors" => $this->model->errors(), "status" => true])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
|
||||
public function allItemsSelect()
|
||||
public function create_imposicion_esquema()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||
$menu = $this->model->getAllForMenu($reqVal . ', ancho', 'ancho', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->ancho = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
$bodyData = $this->request->getPost();
|
||||
$createdId = $this->imposicionEsquemaModel->insert($bodyData);
|
||||
if ($createdId) {
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true]);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_error"), "errors" => $this->imposicionEsquemaModel->errors(), "status" => true])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'ancho'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getOrientacionOptions()
|
||||
{
|
||||
$orientacionOptions = [
|
||||
'' => lang('Basic.global.pleaseSelect'),
|
||||
'H' => 'H',
|
||||
'V' => 'V',
|
||||
];
|
||||
return $orientacionOptions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
86
ci4/app/Controllers/Configuracion/MaquinaTarea.php
Executable file
86
ci4/app/Controllers/Configuracion/MaquinaTarea.php
Executable file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Configuracion\MaquinaTareaModel;
|
||||
use CodeIgniter\HTTP\Response;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use CodeIgniter\I18n\Time;
|
||||
|
||||
class MaquinaTarea extends BaseController
|
||||
{
|
||||
|
||||
protected MaquinaTareaModel $maquinaTareaModel;
|
||||
protected $format = 'json';
|
||||
protected array $viewData = [];
|
||||
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/maquina_tareas/';
|
||||
protected static $controllerSlug = "maquina-tareas";
|
||||
protected $indexRoute = 'viewMaquinaTarea';
|
||||
protected $editRoute = 'editMaquinaTarea';
|
||||
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->maquinaTareaModel = model(MaquinaTareaModel::class);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_maquina_tareas"), 'route' => site_url('configuracion/maquina-tareas'), 'active' => true]
|
||||
];
|
||||
return view(static::$viewPath . $this->indexRoute, $this->viewData);
|
||||
}
|
||||
public function viewForm(int $maquina_tarea_id)
|
||||
{
|
||||
$maquinaTarea = $this->maquinaTareaModel->find($maquina_tarea_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_maquina_tareas"), 'route' => site_url('configuracion/maquina-tareas'), 'active' => false],
|
||||
['title' => $maquinaTarea->name, 'route' => site_url('configuracion/maquina-tareas/edit/' . $maquina_tarea_id), 'active' => true]
|
||||
];
|
||||
$this->viewData["model"] = $maquinaTarea;
|
||||
|
||||
return view(static::$viewPath . $this->editRoute, $this->viewData);
|
||||
}
|
||||
public function show(int $id)
|
||||
{
|
||||
$data = $this->maquinaTareaModel->find($id);
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function update_servicio_cliente(int $id)
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
$status = $this->maquinaTareaModel->update($id, [
|
||||
"name" => $data["name"],
|
||||
"description" => $data["description"]
|
||||
]);
|
||||
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status]);
|
||||
}
|
||||
public function store()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$r = $this->maquinaTareaModel->insert($bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r,"data" => $bodyData]);
|
||||
}
|
||||
public function delete(int $maquina_tarea_id){
|
||||
$r = $this->maquinaTareaModel->delete($maquina_tarea_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => $r]);
|
||||
}
|
||||
public function datatable()
|
||||
{
|
||||
$query = $this->maquinaTareaModel->getQueryDatatable()->orderBy("created_at", "DESC");
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
<?php
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -8,6 +9,8 @@ use App\Models\Collection;
|
||||
use App\Entities\Configuracion\Maquina;
|
||||
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Services\MaquinaService;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
|
||||
class Maquinas extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
@ -25,24 +28,25 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/maquinas/';
|
||||
|
||||
protected $indexRoute = 'maquinaList';
|
||||
|
||||
protected MaquinaService $maquinaService;
|
||||
protected Validation $validation;
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Maquinas.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
$this->maquinaService = service('maquina');
|
||||
$this->validation = service('validation');
|
||||
// Se indica que este controlador trabaja con soft_delete
|
||||
$this->soft_delete = true;
|
||||
// Se indica el flag para los ficheros borrados
|
||||
$this->delete_flag = 1;
|
||||
|
||||
$this->viewData = ['usingServerSideDataTable' => true]; // JJO
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_maquina"), 'route' => site_url('configuracion/maquinas'), 'active' => true]
|
||||
['title' => lang("App.menu_maquina"), 'route' => route_to('maquinaList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -65,14 +69,50 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
return view(static::$viewPath . 'viewMaquinaList', $viewData);
|
||||
}
|
||||
|
||||
public function delete($id = null)
|
||||
{
|
||||
// Sanitizar el ID
|
||||
$id = filter_var($id, FILTER_SANITIZE_URL);
|
||||
|
||||
// Validar que el ID es válido
|
||||
if (empty($id) || !is_numeric($id)) {
|
||||
return $this->respond(['status' => 'error', 'msg' => 'ID no válida']);
|
||||
}
|
||||
|
||||
// Buscar la máquina en la base de datos
|
||||
$maquina = $this->model->find($id);
|
||||
if (!$maquina) {
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Maquinas.maquina')), $id]);
|
||||
return $this->respond(['status' => 'error', 'msg' => 'ID no válida']);
|
||||
}
|
||||
|
||||
// Verificar que el usuario está autenticado
|
||||
if (!auth()->user()) {
|
||||
return $this->respond(['status' => 'error', 'msg' => 'Usuario no autenticado']);
|
||||
}
|
||||
|
||||
// Preparar los datos para actualizar
|
||||
$data = [
|
||||
'id' => $id,
|
||||
'is_deleted' => 1,
|
||||
'deleted_at' => date('Y-m-d H:i:s'),
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
];
|
||||
|
||||
// Guardar los cambios
|
||||
if (!$this->model->save($data)) {
|
||||
return $this->respond(['status' => 'error', 'msg' => 'Error al eliminar']);
|
||||
}
|
||||
|
||||
// Retornar éxito
|
||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]) . '.';
|
||||
return $this->respond(['status' => 'error', 'msg' => $message]);
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -84,10 +124,10 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
$sanitizedData['user_created_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -101,14 +141,14 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('configuracion/maquinas/edit/' . $id))->with('sweet-success', $message);
|
||||
else:
|
||||
@ -138,20 +178,20 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$maquina = $this->model->find($id);
|
||||
|
||||
if ($maquina == false) :
|
||||
if ($maquina == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Maquinas.maquina')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -167,21 +207,26 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('is_inkjet') == null) {
|
||||
$sanitizedData['is_inkjet'] = false;
|
||||
}
|
||||
if ($this->request->getPost('etiqueta_envio') == null) {
|
||||
$sanitizedData['etiqueta_envio'] = false;
|
||||
}
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
//JJO: comprobar alto y ancho impresion < alto y ancho
|
||||
if ($sanitizedData['alto'] < $sanitizedData['alto_impresion']) {
|
||||
$successfulResult = false;
|
||||
$this->viewData['errorMessage'] = lang('Maquinas.validation.alto_menor_alto_impresion');;
|
||||
$this->viewData['errorMessage'] = lang('Maquinas.validation.alto_menor_alto_impresion');
|
||||
;
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
} else if ($sanitizedData['ancho'] < $sanitizedData['ancho_impresion']) {
|
||||
$successfulResult = false;
|
||||
$this->viewData['errorMessage'] = lang('Maquinas.validation.ancho_menor_ancho_impresion');;
|
||||
$this->viewData['errorMessage'] = lang('Maquinas.validation.ancho_menor_ancho_impresion');
|
||||
;
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
} else {
|
||||
try {
|
||||
@ -202,12 +247,12 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $maquina->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -243,22 +288,24 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = MaquinaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
foreach ($resourceData as $item) :
|
||||
if (isset($item->observaciones) && strlen($item->observaciones) > 100) :
|
||||
$item->observaciones = character_limiter($item->observaciones, 100);
|
||||
endif;
|
||||
endforeach;
|
||||
$resourceData = $this->model->getResource($searchValues);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = MaquinaModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
$this->model->getResource([])->countAllResults(),
|
||||
$this->model->getResource($searchValues)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -297,7 +344,7 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr, true);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
@ -315,15 +362,19 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function select(){
|
||||
$r = $this->model->getSelectQuery($this->request->getGet("q"));
|
||||
return $this->response->setJSON($r);
|
||||
}
|
||||
|
||||
protected function getMaquinaListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
|
||||
if (!empty($selId)) :
|
||||
if (!empty($selId)):
|
||||
$maquinaModel = model('App\Models\Configuracion\MaquinaModel');
|
||||
|
||||
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
if (!empty($selOption)):
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
@ -341,6 +392,23 @@ class Maquinas extends \App\Controllers\BaseResourceController
|
||||
];
|
||||
return $tipoOptions;
|
||||
}
|
||||
public function duplicate(int $maquina_id)
|
||||
{
|
||||
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData,'maquina_duplicate');
|
||||
if($validated){
|
||||
$this->maquinaService->setMaquina($maquina_id);
|
||||
$duplicated = $this->maquinaService->duplicate($bodyData['name']);
|
||||
return $this->response->setJSON(["data" => $duplicated]);
|
||||
}else{
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
|
||||
}
|
||||
public function find_maquina(int $maquina_id){
|
||||
$maquinaEntity = $this->model->find($maquina_id);
|
||||
return $this->response->setJSON($maquinaEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -225,7 +225,9 @@ class Maquinaspapelesimpresion extends \App\Controllers\BaseResourceController {
|
||||
];
|
||||
|
||||
// Se checkea que no haya otro papel con ese gramaje seleccionado y que la accion sea activar ese papel
|
||||
if($this->model->getPapelActivo($maquina_id, $gramaje)->countAllResults() != 0 && intval($active)==1){
|
||||
// Esta funcionalidad esta mal: habría que comprobar también que tienen el mismo papel genérico. Se opta por
|
||||
// quitar la condición el 22012025
|
||||
/*if($this->model->getPapelActivo($maquina_id, $gramaje)->countAllResults() != 0 && intval($active)==1){
|
||||
$response['error']= lang('MaquinasPapelImpresion.gramaje_duplicado');;
|
||||
$ret_vals = [
|
||||
'DT_RowId' => 'row_'. $papel_id,
|
||||
@ -235,9 +237,9 @@ class Maquinaspapelesimpresion extends \App\Controllers\BaseResourceController {
|
||||
];
|
||||
$response['data'] = $ret_vals;
|
||||
}
|
||||
else{
|
||||
else{*/
|
||||
$this->model->updateRows([$data]);
|
||||
}
|
||||
//}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
<?php
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -12,8 +13,8 @@ use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
DataTables\Editor\Field;
|
||||
DataTables\Editor,
|
||||
DataTables\Editor\Field;
|
||||
|
||||
class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
@ -69,9 +70,9 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -81,10 +82,10 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -98,14 +99,14 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -129,25 +130,25 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$maquinasTarifasImpresion = $this->model->find($id);
|
||||
|
||||
if ($maquinasTarifasImpresion == false) :
|
||||
if ($maquinasTarifasImpresion == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -160,10 +161,10 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -180,12 +181,12 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $maquinasTarifasImpresion->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -220,30 +221,48 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
$response = Editor::inst($db, 'lg_maquinas_tarifas_impresion')
|
||||
->fields(
|
||||
Field::inst('uso')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.uso.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.uso.required')
|
||||
)
|
||||
),
|
||||
Field::inst('tipo')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
|
||||
)
|
||||
),
|
||||
Field::inst('precio')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal'))
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
|
||||
)
|
||||
),
|
||||
Field::inst('margen')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal'))
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal')
|
||||
)
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
|
||||
)
|
||||
),
|
||||
Field::inst('maquina_id'),
|
||||
Field::inst('user_created_id'),
|
||||
@ -269,16 +288,21 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
'maquina_id' => $values['maquina_id'],
|
||||
'tipo' => $values['tipo'],
|
||||
'uso' => $values['uso'],
|
||||
'is_deleted' => 0));
|
||||
'is_deleted' => 0
|
||||
));
|
||||
|
||||
$id = $builder->get()->getFirstRow()->id;
|
||||
$id = $builder->get()->getFirstRow();
|
||||
if ($id) {
|
||||
$id = $id->id;
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if ($builder->countAllResults() >= 1) {
|
||||
if (
|
||||
($action === Editor::ACTION_EDIT && $id != $pkey)
|
||||
|| $action === Editor::ACTION_CREATE
|
||||
) {
|
||||
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if ($builder->countAllResults() >= 1) {
|
||||
if (($action === Editor::ACTION_EDIT && $id != $pkey)
|
||||
|| $action === Editor::ACTION_CREATE) {
|
||||
|
||||
return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
|
||||
return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -413,11 +437,11 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
|
||||
protected function getMaquinaListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
|
||||
if (!empty($selId)) :
|
||||
if (!empty($selId)):
|
||||
$maquinaModel = model('App\Models\Configuracion\MaquinaModel');
|
||||
|
||||
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
if (!empty($selOption)):
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
<?php
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -9,6 +10,8 @@ use App\Entities\Configuracion\PaisEntity;
|
||||
|
||||
use App\Models\Configuracion\PaisModel;
|
||||
|
||||
use Hermawan\DataTables\DataTable;
|
||||
|
||||
class Paises extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
@ -62,17 +65,17 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
if ($successfulResult = $this->canValidate()):
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -86,14 +89,14 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -117,20 +120,20 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$paisEntity = $this->model->find($id);
|
||||
|
||||
if ($paisEntity == false) :
|
||||
if ($paisEntity == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Paises.pais')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -143,10 +146,10 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -163,12 +166,12 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $paisEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -193,30 +196,38 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = PaisModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$q = $this->model->getDatatableQuery();
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
$result = DataTable::of($q)
|
||||
->edit(
|
||||
"show_erp",
|
||||
function ($row, $meta) {
|
||||
if($row->show_erp == 1) {
|
||||
return '<i class="ti ti-check"></i>';
|
||||
}else{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
)
|
||||
->add("actionBtns", callback: function ($q) {
|
||||
$actions = '';
|
||||
if (auth()->user()->can('paises.edit')) {
|
||||
$actions .= '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>';
|
||||
}
|
||||
if (auth()->user()->can('paises.delete')) {
|
||||
$actions .= '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>';
|
||||
}
|
||||
return $actions;
|
||||
});
|
||||
|
||||
return $result->toJson(returnAsObject: true);
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function allItemsSelect()
|
||||
@ -269,4 +280,25 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_paises.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_papelgenerico"), 'route' => site_url('configuracion/papelesgenericos'), 'active' => true]
|
||||
['title' => lang("App.menu_papelgenerico"), 'route' => route_to('papelGenericoList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -72,9 +72,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -84,36 +84,36 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else :
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else :
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else :
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
@ -133,20 +133,20 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$papelGenerico = $this->model->find($id);
|
||||
|
||||
if ($papelGenerico == false) :
|
||||
if ($papelGenerico == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('PapelGenerico.papelGenerico')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -156,22 +156,33 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('show_in_client') == null) {
|
||||
$sanitizedData['show_in_client'] = false;
|
||||
}
|
||||
if ($this->request->getPost('activo') == null) {
|
||||
$sanitizedData['activo'] = false;
|
||||
}
|
||||
if ($this->request->getPost('show_in_client_special') == null) {
|
||||
$sanitizedData['show_in_client_special'] = false;
|
||||
}
|
||||
|
||||
|
||||
if ($sanitizedData['show_in_client_special']) {
|
||||
$sanitizedData['show_in_client'] = true;
|
||||
}
|
||||
if ($sanitizedData['activo']) {
|
||||
$sanitizedData['activo'] = true;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else :
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('PapelGenerico.papelGenerico'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
@ -181,17 +192,17 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
if ($noException && $successfulResult):
|
||||
$id = $papelGenerico->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]).'.';
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else :
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else :
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
@ -205,7 +216,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('PapelGenerico.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
$this->viewData['usingServerSideDataTable'] = true;
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
@ -271,7 +282,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr, true);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
@ -288,4 +299,115 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getPapelCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
$guardas = goSanitize($this->request->getGet('guardas'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$forSelect2 = intval($this->request->getGet('forSelect2') ?? 0);
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if(intval($cubierta) == 1 || intval($sobrecubierta) == 1){
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
|
||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
|
||||
if ($forSelect2) {
|
||||
$menu = array_map(function ($item) {
|
||||
if (isset($item->id)) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'id' => $item->gramaje,
|
||||
'name' => $item->gramaje
|
||||
];
|
||||
}
|
||||
}, $menu);
|
||||
|
||||
return $this->respond($menu);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'papeles' => $menu,
|
||||
'papeles_especiales' => $menu2,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function selectPapelEspecial()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$tapa_dura = $this->request->getGet('tapa_dura') ?? 0;
|
||||
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
|
||||
$items = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, false, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
$items = array_map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
}, $items);
|
||||
return $this->response->setJSON($items);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ use
|
||||
|
||||
|
||||
use App\Models\Collection;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
|
||||
|
||||
|
||||
@ -35,7 +36,6 @@ use App\Models\Configuracion\PapelImpresionTipologiaModel;
|
||||
use App\Models\Configuracion\MaquinasPapelesImpresionModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
|
||||
|
||||
class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
@ -52,6 +52,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/papel/';
|
||||
|
||||
protected $indexRoute = 'papelImpresionList';
|
||||
protected Validation $validation;
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
@ -66,11 +67,12 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
$this->delete_flag = 1;
|
||||
|
||||
$this->tpModel = new PapelImpresionTipologiaModel();
|
||||
$this->validation = service("validation");
|
||||
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_papelimpresion"), 'route' => site_url('configuracion/papelesimpresion'), 'active' => true]
|
||||
['title' => lang("App.menu_papelimpresion"), 'route' => route_to('papelImpresionList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -175,7 +177,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
$nullIfEmpty = false; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
@ -188,6 +190,9 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('defecto') == null) {
|
||||
$sanitizedData['defecto'] = false;
|
||||
}
|
||||
if ($this->request->getPost('interior') == null) {
|
||||
$sanitizedData['interior'] = false;
|
||||
}
|
||||
if ($this->request->getPost('bn') == null) {
|
||||
$sanitizedData['bn'] = false;
|
||||
}
|
||||
@ -197,6 +202,9 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('cubierta') == null) {
|
||||
$sanitizedData['cubierta'] = false;
|
||||
}
|
||||
if ($this->request->getPost('use_for_tapa_dura') == null) {
|
||||
$sanitizedData['use_for_tapa_dura'] = false;
|
||||
}
|
||||
if ($this->request->getPost('sobrecubierta') == null) {
|
||||
$sanitizedData['sobrecubierta'] = false;
|
||||
}
|
||||
@ -209,6 +217,12 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('inkjet') == null) {
|
||||
$sanitizedData['inkjet'] = false;
|
||||
}
|
||||
if ($this->request->getPost('isActivo') == null) {
|
||||
$sanitizedData['isActivo'] = false;
|
||||
}
|
||||
if ($this->request->getPost('use_in_client') == null) {
|
||||
$sanitizedData['use_in_client'] = false;
|
||||
}
|
||||
|
||||
// Hay que asegurarse de que se quitan los consumos de tintas de rotativa
|
||||
// en caso de que se haya deseleccionado la opción rotativa
|
||||
@ -405,7 +419,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
if (!empty($selId)) :
|
||||
$papelGenericoModel = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
|
||||
$selOption = $papelGenericoModel->where('id', $selId)->findColumn('nombre');
|
||||
$selOption = $papelGenericoModel->where('is_deleted', 0)->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
@ -431,4 +445,38 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
$ma_pa_model->updateRows($active_values);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Duplica el papel impresion y sus relaciones
|
||||
*
|
||||
* @param int $papel_impresion_id
|
||||
* @return Response
|
||||
*/
|
||||
public function duplicate( int $papel_impresion_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "papel_impresion_duplicate");
|
||||
if($validated){
|
||||
$papelImpresionEntity = $this->model->find($papel_impresion_id);
|
||||
$papelImpresionService = service('papel_impresion');
|
||||
$duplicated = $papelImpresionService
|
||||
->setPapelImpresionEntity($papelImpresionEntity)
|
||||
->duplicate($bodyData["name"]);
|
||||
return $this->response->setJSON(["data" => $duplicated]);
|
||||
|
||||
}else{
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
|
||||
}
|
||||
public function papel_impresion_select()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
$data = $this->model->querySelect($q)->get()->getResultArray();
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function papel_impresion_find(int $papel_impresion_id)
|
||||
{
|
||||
$piEntity = $this->model->find($papel_impresion_id);
|
||||
return $this->response->setJSON($piEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,23 +244,15 @@ class Papelformato extends \App\Controllers\BaseResourceController {
|
||||
|
||||
public function menuItems() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'ancho'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
|
||||
$searchStr = goSanitize($this->request->getPfgost('searchTerm'))[0];
|
||||
$menu = $papelFormatoModel->getElementsForMenu2($searchStr);
|
||||
if(empty(($searchStr)))
|
||||
array_shift($menu);
|
||||
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
@ -268,4 +260,15 @@ class Papelformato extends \App\Controllers\BaseResourceController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getSelect2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$data = $this->model->getElementsForMenu2($this->request->getGet("q"));
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ class Papelimpresionmargenes extends \App\Controllers\BaseResourceController
|
||||
$id_PI = $reqData['id_PI'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getResource("", $id_PI)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
|
||||
@ -271,6 +271,27 @@ class Provincias extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_provincias.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems($selId = null)
|
||||
{
|
||||
|
||||
268
ci4/app/Controllers/Configuracion/SeriesFacturas.php
Executable file
268
ci4/app/Controllers/Configuracion/SeriesFacturas.php
Executable file
@ -0,0 +1,268 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Models\Collection;
|
||||
use App\Entities\Configuracion\SeriesFacturasEntity;
|
||||
use App\Models\Configuracion\SeriesFacturasModel;
|
||||
|
||||
class SeriesFacturas extends BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = SeriesFacturasModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Series Facturas';
|
||||
protected static $singularObjectNameCc = 'seriesFacturas';
|
||||
protected static $pluralObjectName = 'Series Facturas';
|
||||
protected static $pluralObjectNameCc = 'seriesFacturas';
|
||||
|
||||
protected static $controllerSlug = 'ubicaciones';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/series-facturas/';
|
||||
|
||||
protected $indexRoute = 'seriesFacturasList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('SeriesFacturas.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_series_facturas"), 'route' => route_to('seriesFacturasList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('SeriesFacturas.moduleTitle')]),
|
||||
'seriesFacturasEntity' => new SeriesFacturasEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . 'viewSeriesFacturasList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['seriesFacturasEntity'] = isset($sanitizedData) ? new SeriesFacturasEntity($sanitizedData) : new SeriesFacturasEntity();
|
||||
$this->viewData['formAction'] = route_to('seriesFacturasAdd');
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('SeriesFacturas.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$seriesFacturasEntity = $this->model->find($id);
|
||||
|
||||
if ($seriesFacturasEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('SeriesFacturas.moduleTitle')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
if ($this->request->getPost('show_erp') == null) {
|
||||
$sanitizedData['show_erp'] = false;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('SeriesFacturas.moduleTitle'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$seriesFacturasEntity->fill($sanitizedData);
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $seriesFacturasEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['seriesFacturasEntity'] = $seriesFacturasEntity;
|
||||
$this->viewData['formAction'] = route_to('seriesFacturasEdit', $id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('SeriesFacturas.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = SeriesFacturasModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function allItemsSelect()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||
$menu = $this->model->getAllForMenu($reqVal . ', nombre', 'nombre', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->nombre = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItemsFacturas()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$menu = $this->model->getMenuItemsFacturas();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
257
ci4/app/Controllers/Configuracion/Ubicaciones.php
Executable file
257
ci4/app/Controllers/Configuracion/Ubicaciones.php
Executable file
@ -0,0 +1,257 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Models\Collection;
|
||||
use App\Entities\Configuracion\UbicacionesEntity;
|
||||
use App\Models\Configuracion\UbicacionesModel;
|
||||
|
||||
class Ubicaciones extends BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = UbicacionesModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Ubicaciones';
|
||||
protected static $singularObjectNameCc = 'ubicaciones';
|
||||
protected static $pluralObjectName = 'Ubicaciones';
|
||||
protected static $pluralObjectNameCc = 'ubicaciones';
|
||||
|
||||
protected static $controllerSlug = 'ubicaciones';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/ubicaciones/';
|
||||
|
||||
protected $indexRoute = 'ubicacionesList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Ubicaciones.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_ubicaciones"), 'route' => route_to('ubicacionesList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Ubicaciones.pais')]),
|
||||
'ubicacionesEntity' => new UbicacionesEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . 'viewUbicacionesList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['ubicacionesEntity'] = isset($sanitizedData) ? new UbicacionesEntity($sanitizedData) : new UbicacionesEntity();
|
||||
$this->viewData['formAction'] = route_to('ubicacionesAdd');
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Ubicaciones.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$ubicacionesEntity = $this->model->find($id);
|
||||
|
||||
if ($ubicacionesEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Ubicaciones.moduleTitle')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
if ($this->request->getPost('show_erp') == null) {
|
||||
$sanitizedData['show_erp'] = false;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Ubicaciones.moduleTitle'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$ubicacionesEntity->fill($sanitizedData);
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $ubicacionesEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['ubicacionesEntity'] = $ubicacionesEntity;
|
||||
$this->viewData['formAction'] = route_to('ubicacionesEdit', $id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Ubicaciones.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = UbicacionesModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function allItemsSelect()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||
$menu = $this->model->getAllForMenu($reqVal . ', nombre', 'nombre', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->nombre = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,24 +1,31 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Entities\Usuarios\UserEntity;
|
||||
|
||||
use App\Models\Chat\ChatDeparmentModel;
|
||||
use App\Models\Chat\ChatDeparmentUserModel;
|
||||
use App\Models\Usuarios\GroupModel;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use App\Models\Usuarios\GroupsUsersModel;
|
||||
use CodeIgniter\Shield\Entities\User;
|
||||
use App\Models\Collection;
|
||||
|
||||
class Users extends \App\Controllers\GoBaseController {
|
||||
|
||||
class Users extends \App\Controllers\GoBaseController
|
||||
{
|
||||
|
||||
private $group_model;
|
||||
private $group_user_model;
|
||||
private $user_model;
|
||||
private ChatDeparmentModel $chat_department_model;
|
||||
private ChatDeparmentUserModel $chat_department_user_model;
|
||||
|
||||
|
||||
use \CodeIgniter\API\ResponseTrait;
|
||||
use \CodeIgniter\API\ResponseTrait;
|
||||
|
||||
protected static $primaryModelName = 'App\Models\UserModel';
|
||||
protected static $primaryModelName = UserModel::class;
|
||||
protected $modelName = ClientePlantillaPreciosLineasModel::class;
|
||||
|
||||
protected static $singularObjectNameCc = 'user';
|
||||
protected static $singularObjectName = 'User';
|
||||
@ -29,88 +36,124 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
|
||||
protected $indexRoute = 'userList';
|
||||
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
|
||||
$this->group_model = new GroupModel();
|
||||
$this->group_user_model = new GroupsUsersModel();
|
||||
$this->user_model = new UserModel();
|
||||
$this->chat_department_model = model(ChatDeparmentModel::class);
|
||||
$this->chat_department_user_model = model(ChatDeparmentUserModel::class);
|
||||
|
||||
|
||||
$this->viewData['pageTitle'] = lang('Users.moduleTitle');
|
||||
|
||||
// Breadcrumbs (IMN)
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_users"), 'route' => site_url('configuracion/users'), 'active' => true]
|
||||
['title' => lang("App.menu_users"), 'route' => route_to('userList'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
|
||||
}
|
||||
|
||||
public function index() {
|
||||
|
||||
$this->viewData['usingClientSideDataTable'] = true;
|
||||
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Users.user')]);
|
||||
$this->viewData['user_model'] = $this->user_model;
|
||||
public function index()
|
||||
{
|
||||
$this->viewData['usingServerSideDataTable'] = true;
|
||||
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Users.user')]);
|
||||
|
||||
parent::index();
|
||||
|
||||
}
|
||||
|
||||
public function add() {
|
||||
public function add()
|
||||
{
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$currentGroups = $postData['group']??[];
|
||||
unset($postData['group']);
|
||||
// Obtener contraseña nueva si se ha introducido en texto plano
|
||||
if (empty($postData['new_pwd'])) {
|
||||
$postData['password'] = 'Safekat2024'; // Contraseña por defecto
|
||||
} else {
|
||||
$postData['password'] = $postData['new_pwd'];
|
||||
}
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
// Obtener los grupos a los que pertenece
|
||||
$currentGroups = $postData['group'] ?? [];
|
||||
$chatDepartments = $postData['chatDepartments'] ?? [];
|
||||
unset($postData['group']);
|
||||
unset($postData['chatDepartments']);
|
||||
|
||||
// Marcar el username como NULL
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
|
||||
// Obtener proveedor de usuarios
|
||||
$users = auth()->getProvider();
|
||||
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
// The Email is unique
|
||||
if ($this->user_model->isEmailUnique($sanitizedData['email'])) {
|
||||
|
||||
$user = new User([
|
||||
'username' => strstr($sanitizedData['email'], '@', true),
|
||||
'email' => $sanitizedData['email'],
|
||||
'password' => 'Safekat2024',
|
||||
]);
|
||||
$users->save($user);
|
||||
$successfulResult = true; // Hacked
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Users.user'))]);
|
||||
// Crear el usuario si pasa la validación
|
||||
$user = new \CodeIgniter\Shield\Entities\User([
|
||||
'username' => null, // If you don't have a username, be sure to set the value to null anyway, so that it passes CodeIgniter's empty data check
|
||||
'first_name' => $sanitizedData['first_name'],
|
||||
'last_name' => $sanitizedData['last_name'],
|
||||
'cliente_id' => $sanitizedData['cliente_id'],
|
||||
'comments' => $sanitizedData['comments'],
|
||||
'email' => $sanitizedData['email'],
|
||||
'password' => $sanitizedData['password'],
|
||||
'status' => $sanitizedData['status'] ?? 0,
|
||||
'active' => $sanitizedData['active'] ?? 0,
|
||||
]);
|
||||
// Add the user to the system
|
||||
$users->save($user);
|
||||
$successfulResult = true; // Hacked
|
||||
|
||||
} // Email is not unique!
|
||||
else {
|
||||
$this->viewData['errorMessage'] = "El correo '" . $sanitizedData['email'] . "' ya está registrado en el sistema";
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
$successfulResult = false; // Hacked
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->viewData['errorMessage'] = $e->getMessage();
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Users.user'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $users->getInsertID();
|
||||
$this->group_user_model->where('user_id', $user->id)->delete();
|
||||
foreach($currentGroups as $group){
|
||||
$this->group_user_model->where('user_id', $id)->delete();
|
||||
foreach ($currentGroups as $group) {
|
||||
$group_user_data = [
|
||||
'user_id' => $user->id,
|
||||
'user_id' => $id,
|
||||
'group' => $group
|
||||
];
|
||||
$this->group_user_model->insert($group_user_data);
|
||||
}
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
foreach ($chatDepartments as $chatDepartment) {
|
||||
$this->chat_department_user_model->insert([
|
||||
"user_id" => $id,
|
||||
"chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()->id
|
||||
]);
|
||||
}
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Users.user'))]) . 'Downloads';
|
||||
$message .= anchor(route_to('editUser', $id), lang('Basic.global.continueEditing').'?');
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Users.user'))]) . '.';
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
@ -128,75 +171,103 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['user'] = isset($sanitizedData) ? new UserEntity($sanitizedData) : new UserEntity();
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems();
|
||||
$this->viewData['formAction'] = route_to('createUser');
|
||||
$this->viewData['groups'] = $this->group_model->select('keyword, title')->findAll();
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') .lang('Users.user').' '.lang('Basic.global.addNewSuffix');
|
||||
|
||||
$this->viewData['chatDepartments'] = $this->chat_department_model->findAll();
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null) {
|
||||
|
||||
if ($requestedId == null) :
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
if ($requestedId == null) {
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
}
|
||||
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$user = $this->model->find($id);
|
||||
$users = auth()->getProvider();
|
||||
$user = $users->findById($id);
|
||||
|
||||
if ($user == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Users.user')), $id]);
|
||||
return $this->redirect2listView('errorMessage', $message);
|
||||
endif;
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$currentGroups = $postData['group'];
|
||||
$currentGroups = $postData['group'] ?? [];
|
||||
$chatDepartments = $postData['chatDepartments'] ?? [];
|
||||
|
||||
unset($postData['group']);
|
||||
unset($postData['chatDepartments']);
|
||||
|
||||
// Obtener contraseña nueva si se ha introducido en texto plano
|
||||
if (!empty($postData['new_pwd'])) {
|
||||
$postData['password'] = $postData['new_pwd'];
|
||||
}
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
if ($this->request->getPost('status') == 0 ) {
|
||||
if ($this->request->getPost('status') == 0) {
|
||||
$sanitizedData['status'] = null;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()) :
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Users.user'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
|
||||
$user->fill($sanitizedData);
|
||||
$thenRedirect = false;
|
||||
if (in_array('cliente-editor', $currentGroups) || in_array('cliente-administrador', $currentGroups)) {
|
||||
if (!array_key_exists('cliente_id', $sanitizedData) || is_null($sanitizedData['cliente_id'])) {
|
||||
$this->viewData['errorMessage'] = lang('Users.errors.cliente_sin_clienteID');
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
$successfulResult = false;
|
||||
} else {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
}
|
||||
} else {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Users.user'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$user->fill($sanitizedData);
|
||||
$users->save($user);
|
||||
$thenRedirect = false;
|
||||
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$this->group_user_model->where('user_id', $user->id)->delete();
|
||||
foreach($currentGroups as $group){
|
||||
foreach ($currentGroups as $group) {
|
||||
$group_user_data = [
|
||||
'user_id' => $user->id,
|
||||
'group' => $group
|
||||
];
|
||||
$this->group_user_model->insert($group_user_data);
|
||||
}
|
||||
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
foreach ($chatDepartments as $chatDepartment) {
|
||||
$this->chat_department_user_model->insert([
|
||||
"user_id" => $id,
|
||||
"chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()->id
|
||||
]);
|
||||
}
|
||||
$id = $user->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Users.user'))]) . 'Downloads';
|
||||
$message .= anchor(route_to('editUser', $id), lang('Basic.global.continueEditing').'?');
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Users.user'))]) . '.';
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
@ -208,21 +279,25 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['user'] = $user;
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($user->cliente_id);
|
||||
$this->viewData['formAction'] = route_to('updateUser', $id);
|
||||
$this->viewData['selectedGroups'] = $this->group_model->getUsersRoles($requestedId);
|
||||
$this->viewData['groups'] = $this->group_model->select('keyword, title')->findAll();
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') .lang('Users.user').' '.lang('Basic.global.edit3');
|
||||
$this->viewData['chatDepartments'] = $this->chat_department_model->select(["display", "name", "id as chatDepartmentId"])->findAll();
|
||||
$this->viewData['chatDepartmentUser'] = $this->chat_department_user_model->getChatDepartmentUser($user->id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function delete($requestedId = null, bool $deletePermanently = true) {
|
||||
public function delete($requestedId = null, bool $deletePermanently = true)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
@ -236,27 +311,26 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
return $this->redirect2listView('errorMessage', $message);
|
||||
endif;
|
||||
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
|
||||
$users = auth()->getProvider();
|
||||
$users->delete($user->id, $deletePermanently);
|
||||
$users->delete($user->id);
|
||||
|
||||
$message = "Usuario eliminado correctamente";
|
||||
return $this->redirect2listView('successMessage', $message);
|
||||
|
||||
|
||||
|
||||
} // end function delete(...)
|
||||
|
||||
|
||||
|
||||
public function allItemsSelect() {
|
||||
|
||||
public function allItemsSelect()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id_user';
|
||||
$menu = $this->model->getAllForMenu($reqVal.', first_name', 'first_name', $onlyActiveOnes, false);
|
||||
$menu = $this->model->getAllForMenu($reqVal . ', first_name', 'first_name', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id_user = '';
|
||||
$nonItem->first_name = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
$nonItem->first_name = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -269,8 +343,9 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems() {
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
@ -281,8 +356,8 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -296,14 +371,100 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems() {
|
||||
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Pais.pais'))])];
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
|
||||
$resourceData = $this->model->getResource($searchValues);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = UserModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource([])->countAllResults(),
|
||||
$this->model->getResource($searchValues)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getMenuComerciales()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$comerciales = $this->model->getComerciales();
|
||||
|
||||
return $this->respond($comerciales);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems()
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Pais.pais'))])];
|
||||
$paisModel = model('App\Models\Configuracion\PaisModel');
|
||||
|
||||
$registers = $paisModel->findAll();
|
||||
|
||||
return $registers;
|
||||
}
|
||||
|
||||
return $registers;
|
||||
}
|
||||
|
||||
protected function getClienteListItems($selId = null)
|
||||
{
|
||||
$data = ['' => ""];
|
||||
if (!empty($selId)) :
|
||||
$clienteModel = model('App\Models\Clientes\ClienteModel');
|
||||
|
||||
$selOption = $clienteModel->where('id', $selId)->findColumn('nombre');
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function index_maquinista_change_user()
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_change_session"), 'route' => route_to('maquinistaUserChangeList'), 'active' => true]
|
||||
];
|
||||
$maquinistas = [];
|
||||
$users = auth()->getProvider()->whereNotIn('id',[auth()->user()->id])->findAll();
|
||||
foreach ($users as $key => $user) {
|
||||
if ($user->inGroup('maquina') && !$user->inGroup('admin', 'comercial', 'cliente-editor', 'cliente-admin')) {
|
||||
$maquinistas[] = $user;
|
||||
}
|
||||
}
|
||||
$this->viewData['maquinistas'] = $maquinistas;
|
||||
return view('/themes/vuexy/form/produccion/maquinista/viewMaquinistaCambioUserList.php', $this->viewData);
|
||||
}
|
||||
public function change_user_session(int $user_id)
|
||||
{
|
||||
// Check the credentials
|
||||
$user = auth()->getProvider()->findById($user_id);
|
||||
auth()->logout();
|
||||
auth()->login($user);
|
||||
return redirect("home");
|
||||
}
|
||||
}
|
||||
|
||||
82
ci4/app/Controllers/Excel/PrintGiros.php
Executable file
82
ci4/app/Controllers/Excel/PrintGiros.php
Executable file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Excel;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
|
||||
class PrintGiros extends BaseController
|
||||
{
|
||||
public function generateExcel($factura_id = null)
|
||||
{
|
||||
// AQUI CREAR LAS CONSULTAS A LA BBDD, QUIZAS HAYA QUE CREARLO O COMO POST O COMO QUERY AJAX
|
||||
|
||||
// Crear un nuevo Spreadsheet
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
// Especificar encabezados
|
||||
$headers = [
|
||||
'BIC (SWIFT)*',
|
||||
'FECHA FIRMA MANDATO*',
|
||||
'IBAN*',
|
||||
'IMPORTE*',
|
||||
'NOMBRE*',
|
||||
'PAIS*',
|
||||
'REFERENCIA DEL ADEUDO (REFADEUDO)*',
|
||||
'REFERENCIA*',
|
||||
'REFERENCIA DEL MANDATO (REMANDATO)*',
|
||||
'RESIDENTE*',
|
||||
'TIPO DE ADEUDO*',
|
||||
'FECHA DE COBRO*',
|
||||
'DIAS*'
|
||||
];
|
||||
|
||||
// Establecer los encabezados en la primera fila
|
||||
$column = 'A';
|
||||
foreach ($headers as $header) {
|
||||
$sheet->setCellValue($column . '1', $header);
|
||||
$column++;
|
||||
}
|
||||
|
||||
// Generar datos dummy
|
||||
$dummyData = [
|
||||
['ABCDEF12', '2024-01-01', 'ES1234567890123456789012', 100.50, 'John Doe', 'Spain', 'REF001', '12345', 'MAND001', 'Yes', 'Type1', '2024-02-01', 30],
|
||||
['GHIJKL34', '2024-02-01', 'ES9876543210987654321098', 200.75, 'Jane Smith', 'France', 'REF002', '67890', 'MAND002', 'No', 'Type2', '2024-03-01', 60],
|
||||
// Añade más datos dummy según sea necesario
|
||||
];
|
||||
|
||||
// Rellenar las filas con datos dummy
|
||||
$rowNumber = 2; // Empezar en la segunda fila
|
||||
foreach ($dummyData as $row) {
|
||||
$column = 'A';
|
||||
foreach ($row as $cell) {
|
||||
$sheet->setCellValue($column . $rowNumber, $cell);
|
||||
$column++;
|
||||
}
|
||||
$rowNumber++;
|
||||
}
|
||||
|
||||
// Ajustar automáticamente el tamaño de las columnas
|
||||
foreach (range('A', $column) as $col) {
|
||||
$sheet->getColumnDimension($col)->setAutoSize(true);
|
||||
}
|
||||
|
||||
// Crear un escritor para guardar el archivo
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
|
||||
// Configurar la respuesta para descarga
|
||||
$fileName = 'giros_reporte.xlsx';
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $fileName . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// Escribir el archivo a la salida
|
||||
$writer->save('php://output');
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
70
ci4/app/Controllers/Excel/PrintLineas.php
Executable file
70
ci4/app/Controllers/Excel/PrintLineas.php
Executable file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Excel;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
|
||||
class PrintLineas extends BaseController
|
||||
{
|
||||
public function generateExcel($factura_id = null)
|
||||
{
|
||||
|
||||
// Modelos
|
||||
$lineasFacturaModel = model('App\Models\Facturas\FacturaLineaModel');
|
||||
$infoLineasFactura = $lineasFacturaModel->getResourceForExcel($factura_id)->get()->getResultObject();
|
||||
|
||||
|
||||
// Crear un nuevo Spreadsheet
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
// Especificar encabezados
|
||||
$headers = [
|
||||
'Factura',
|
||||
'ID Pedido',
|
||||
'Ref. Cliente',
|
||||
'Base'
|
||||
];
|
||||
|
||||
// Establecer los encabezados en la primera fila
|
||||
$column = 'A';
|
||||
foreach ($headers as $header) {
|
||||
$sheet->setCellValue($column . '1', $header);
|
||||
$column++;
|
||||
}
|
||||
|
||||
// Rellenar las filas con datos
|
||||
$rowNumber = 2; // Empezar en la segunda fila
|
||||
foreach ($infoLineasFactura as $infoLineaFactura) {
|
||||
$column = 'A';
|
||||
foreach ($infoLineaFactura as $cell) {
|
||||
$sheet->setCellValue($column . $rowNumber, $cell);
|
||||
$column++;
|
||||
}
|
||||
$rowNumber++;
|
||||
}
|
||||
|
||||
// Ajustar automáticamente el tamaño de las columnas
|
||||
foreach (range('A', $column) as $col) {
|
||||
$sheet->getColumnDimension($col)->setAutoSize(true);
|
||||
}
|
||||
|
||||
// Crear un escritor para guardar el archivo
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
|
||||
// Configurar la respuesta para descarga
|
||||
$fileName = 'lineas-pedido.xlsx';
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $fileName . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// Escribir el archivo a la salida
|
||||
$writer->save('php://output');
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Facturacion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Albaran extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Albaran';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Facturacion;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Factura extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'Facturas';
|
||||
}
|
||||
|
||||
public function nueva()
|
||||
{
|
||||
echo 'Nueva Factura';
|
||||
}
|
||||
|
||||
public function vencimiento()
|
||||
{
|
||||
echo 'Vencimiento Factura';
|
||||
}
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
939
ci4/app/Controllers/Facturacion/Facturas.php
Executable file
939
ci4/app/Controllers/Facturacion/Facturas.php
Executable file
@ -0,0 +1,939 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Facturacion;
|
||||
|
||||
use App\Models\Facturas\FacturaModel;
|
||||
use App\Entities\Facturas\FacturaEntity;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Collection;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use Exception;
|
||||
|
||||
class Facturas extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
protected $modelName = FacturaModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectNameCc = 'factura';
|
||||
protected static $singularObjectName = 'Factura';
|
||||
protected static $pluralObjectName = 'Facturas';
|
||||
protected static $controllerSlug = 'factura';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/facturas/';
|
||||
|
||||
protected $indexRoute = 'facturaList';
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Facturas.facturas');
|
||||
// Se indica que este controlador trabaja con soft_delete
|
||||
|
||||
$this->viewData = ['usingServerSideDataTable' => true];
|
||||
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_facturas"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('facturas.menu');
|
||||
|
||||
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
|
||||
// Se obtiene el cliente ID a partir del usuario de la sesion
|
||||
$model_user = model('App\Models\Usuarios\UserModel');
|
||||
$user = $model_user->find(auth()->user()->id);
|
||||
$clienteId = $user->cliente_id;
|
||||
} else {
|
||||
$clienteId = -1;
|
||||
}
|
||||
|
||||
$this->viewData['cliente_id'] = $clienteId;
|
||||
|
||||
$this->viewData['usingClientSideDataTable'] = true;
|
||||
|
||||
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]);
|
||||
parent::index();
|
||||
}
|
||||
|
||||
|
||||
public function list()
|
||||
{
|
||||
checkGroups(['admin', 'cliente-admin', 'cliente-editor', 'contabilidad']);
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Facturas.facturas')]),
|
||||
'usingServerSideDataTable' => true,
|
||||
'pageTitle' => lang('Facturas.facturas'),
|
||||
['title' => lang("App.menu_facturas"), 'route' => site_url('facturas/list'), 'active' => true]
|
||||
];
|
||||
|
||||
$viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_facturas"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("Facturas.facturaList"), 'route' => "javascript:void(0);", 'active' => true]
|
||||
];
|
||||
|
||||
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
|
||||
// Se obtiene el cliente ID a partir del usuario de la sesion
|
||||
$model_user = model('App\Models\Usuarios\UserModel');
|
||||
$user = $model_user->find(auth()->user()->id);
|
||||
$clienteId = $user->cliente_id;
|
||||
} else {
|
||||
$clienteId = -1;
|
||||
}
|
||||
|
||||
$viewData['cliente_id'] = $clienteId;
|
||||
|
||||
// Establecer el idioma (opcional, si no está configurado en app/Config/App.php)
|
||||
$locale = explode('-', config('Basics')->i18n)[0]; // Or dynamically set it: \Config\Services::language()->getLocale();
|
||||
// Specify the language file name (without .php)
|
||||
$fileName = 'datePicker';
|
||||
// Build the path to the language file
|
||||
$filePath = APPPATH . "Language/{$locale}/{$fileName}.php";
|
||||
// Load the entire language file as an array
|
||||
$viewData['datepickerLang'] = json_encode(file_exists($filePath) ? require $filePath : []);
|
||||
$viewData['datepickerLocale'] = config('Basics')->i18n;
|
||||
|
||||
return view(static::$viewPath . 'viewFacturasList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
checkPermission('facturas.create');
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$noException = true;
|
||||
$allData = true;
|
||||
|
||||
if (!isset($postData['cliente_id']) || !isset($postData['serie_id'])) {
|
||||
|
||||
$this->viewData['errorMessage'] = lang('Facturas.errors.requiredFields');
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
$allData = false;
|
||||
$noException = false;
|
||||
}
|
||||
|
||||
try {
|
||||
$clienteModel = model('App\Models\Clientes\ClienteModel');
|
||||
$datosCliente = $clienteModel->getClienteDataFacturas($postData['cliente_id']);
|
||||
if (count($datosCliente) > 0) {
|
||||
// add array data datosCliente to postData
|
||||
$postData = array_merge($postData, $datosCliente[0]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
||||
$sanitizedData['user_created_id'] = auth()->user()->id;
|
||||
|
||||
if (!$sanitizedData['creditoAsegurado']) {
|
||||
$sanitizedData['creditoAsegurado'] = 0;
|
||||
}
|
||||
|
||||
if ($allData && $successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
return redirect()->to(route_to('editarFactura', $id))->with('sweet-success', $message);
|
||||
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['factura'] = isset($sanitizedData) ? new FacturaEntity($sanitizedData) : new FacturaEntity();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createFactura');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Facturas.facturas') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
helper('form');
|
||||
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_facturas"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("Facturas.facturaList"), 'route' => route_to('facturasList'), 'active' => true]
|
||||
];
|
||||
|
||||
$this->viewData['usingSelect2'] = true;
|
||||
|
||||
$validation = \Config\Services::validation();
|
||||
|
||||
$this->viewData['validation'] = $validation;
|
||||
|
||||
$viewFilePath = static::$viewPath . 'viewAddFactura';
|
||||
|
||||
return view($viewFilePath, $this->viewData);
|
||||
} // end function add()
|
||||
|
||||
|
||||
public function edit($id = null)
|
||||
{
|
||||
checkPermission('facturas.edit');
|
||||
|
||||
if ($id == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($id, FILTER_SANITIZE_URL);
|
||||
$factura = $this->model->find($id);
|
||||
|
||||
if ($factura == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Facturas.factura')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
$this->obtenerDatosFormulario($factura);
|
||||
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_facturas"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("Facturas.facturaList"), 'route' => route_to('facturasList'), 'active' => true]
|
||||
];
|
||||
|
||||
$userModel = model('App\Models\Usuarios\UserModel');
|
||||
$factura->created_by = $userModel->getFullName($factura->user_created_id);
|
||||
$factura->updated_by = $userModel->getFullName($factura->user_updated_id);
|
||||
$factura->created_at_footer = $factura->created_at ? date(' H:i d/m/Y', strtotime($factura->created_at)) : '';
|
||||
$factura->updated_at_footer = $factura->updated_at ? date(' H:i d/m/Y', strtotime($factura->updated_at)) : '';
|
||||
|
||||
$factura->showDeleteButton = model('App\Models\Facturas\FacturaPagoModel')
|
||||
->where('factura_id', $factura->id)->countAllResults() == 0;
|
||||
|
||||
if($factura->numero != null && $factura->numero != '' && strpos($factura->numero, "REC ") === 0) {
|
||||
$modelPagos = model('App\Models\Facturas\FacturaPagoModel');
|
||||
if($modelPagos->where('factura_id', $factura->id)->countAllResults() > 0) {
|
||||
$factura->facturaRectificativaPagada = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->viewData['facturaEntity'] = $factura;
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Facturas.factura') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
$dataForClienteForm = false;
|
||||
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
|
||||
// Se obtiene el cliente ID a partir del usuario de la sesion
|
||||
$model_user = model('App\Models\Usuarios\UserModel');
|
||||
$user = $model_user->find(auth()->user()->id);
|
||||
$clienteId = $user->cliente_id;
|
||||
} else {
|
||||
$temp = $this->request->getGet('cliente_id');
|
||||
$clienteId = ($temp && $temp != null && $temp != "") ? $temp : -1;
|
||||
$dataForClienteForm = ($temp && $temp != null && $temp != "") ? true : false;
|
||||
}
|
||||
|
||||
$model = model(FacturaModel::class);
|
||||
$q = $model->getDatatableQuery($clienteId);
|
||||
|
||||
$searchValue = $this->request->getGet('fecha_factura') ?? '';
|
||||
|
||||
if (!empty($searchValue)) {
|
||||
// Extraer las fechas del formato "YYYY-MM-DD|YYYY-MM-DD"
|
||||
$dates = explode('|', $searchValue);
|
||||
if (count($dates) == 2) {
|
||||
$q->where('t1.fecha_factura_at >=', $dates[0] . ' 00:00:00')
|
||||
->where('t1.fecha_factura_at <=', $dates[1] . ' 23:59:59');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = DataTable::of($q)
|
||||
->edit(
|
||||
"creditoAsegurado",
|
||||
function ($row, $meta) {
|
||||
switch ($row->creditoAsegurado) {
|
||||
case "0":
|
||||
return lang('Basic.global.no');
|
||||
case "1":
|
||||
return lang('Basic.global.yes');
|
||||
default:
|
||||
return '--'; // Debug
|
||||
}
|
||||
}
|
||||
)
|
||||
->edit(
|
||||
"estado",
|
||||
function ($row, $meta) {
|
||||
switch ($row->estado) {
|
||||
case "borrador":
|
||||
return lang('Facturas.borrador');
|
||||
case "validada":
|
||||
return lang('Facturas.validada');
|
||||
default:
|
||||
return '--'; // Debug
|
||||
}
|
||||
}
|
||||
)
|
||||
->edit(
|
||||
"estado_pago",
|
||||
function ($row, $meta) {
|
||||
switch ($row->estado_pago) {
|
||||
case "pendiente":
|
||||
return lang('Facturas.pendiente');
|
||||
case "pagada":
|
||||
return lang('Facturas.pagada');
|
||||
case "insolvente":
|
||||
return lang('Facturas.insolvente');
|
||||
default:
|
||||
return '--'; // Debug
|
||||
}
|
||||
}
|
||||
)
|
||||
->edit(
|
||||
"forma_pago",
|
||||
function ($row, $meta) {
|
||||
switch ($row->forma_pago) {
|
||||
case "cheque":
|
||||
return lang('Facturas.cheque');
|
||||
case "compensada":
|
||||
return lang('Facturas.compensada');
|
||||
case "confirming":
|
||||
return lang('Facturas.confirming');
|
||||
case "giroDomiciliado":
|
||||
return lang('Facturas.giroDomiciliado');
|
||||
case "pagare":
|
||||
return lang('Facturas.pagare');
|
||||
case "transferencia":
|
||||
return lang('Facturas.transferencia');
|
||||
default:
|
||||
return $row->forma_pago; // Debug
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
->add("action", callback: function ($q) {
|
||||
if (auth()->user()->can('facturas.edit')) {
|
||||
if ($q->estado == 'borrador') {
|
||||
return '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>
|
||||
';
|
||||
} else {
|
||||
return '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
} else
|
||||
return '';
|
||||
});
|
||||
if ($clienteId != -1) {
|
||||
$result->hide('cliente');
|
||||
$result->hide('creditoAsegurado');
|
||||
if (!$dataForClienteForm) {
|
||||
$result->hide('estado');
|
||||
$result->hide('estado_pago');
|
||||
}
|
||||
$result->hide('forma_pago');
|
||||
$result->hide('vencimiento');
|
||||
$result->hide('dias_vencimiento');
|
||||
}
|
||||
|
||||
return $result->toJson(returnAsObject: true);
|
||||
}
|
||||
|
||||
public function getDatosFacturacionClienteForm($cliente_id)
|
||||
{
|
||||
|
||||
return $this->respond($this->model->getSumatoriosFacturacionCliente($cliente_id));
|
||||
}
|
||||
|
||||
|
||||
public function datatablePedidos()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
|
||||
$order = FacturaModel::SORTABLE_PEDIDOS[$requestedOrder >= 0 ? $requestedOrder : 0];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$pedido_id = $reqData['pedido_id'] ?? 0;
|
||||
|
||||
$resourceData = $this->model->getResourcePedidos($pedido_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResourcePedidos($pedido_id)->countAllResults(),
|
||||
$this->model->getResourcePedidos($pedido_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id = null)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
if ($id == null):
|
||||
$data = [
|
||||
'error' => 2,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
endif;
|
||||
$id = filter_var($id, FILTER_SANITIZE_URL);
|
||||
$facturaEntity = $this->model->find($id);
|
||||
|
||||
if ($facturaEntity == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Factura.factura')), $id]);
|
||||
$data = [
|
||||
'error' => $message,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
endif;
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Facturas.factura'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$facturaEntity->fill($sanitizedData);
|
||||
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
$id = $facturaEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
$data = [
|
||||
'error' => 0,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$data = [
|
||||
'error' => 1,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($id = null)
|
||||
{
|
||||
|
||||
$user_id = auth()->user()->id;
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$rawResult = $this->model->where('id', $id)
|
||||
->set([
|
||||
'deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'user_updated_id' => $user_id,
|
||||
])
|
||||
->update();
|
||||
if (!$rawResult) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
}
|
||||
|
||||
$modelLineas = model('\App\Models\Facturas\FacturaLineaModel');
|
||||
$rawResult = $modelLineas->where('factura_id', $id)
|
||||
->set([
|
||||
'deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'user_updated_id' => $user_id,
|
||||
])
|
||||
->update();
|
||||
|
||||
$this->model->db->query('DELETE FROM facturas_pedidos_lineas WHERE factura_id=' . $id);
|
||||
|
||||
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
public function menuPedidosPendientes($cliente_id)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$model = model('\App\Models\Pedidos\PedidoLineaModel');
|
||||
|
||||
$pedidos = [];
|
||||
try {
|
||||
$pedidos = $model->obtenerLineasPedidoSinFacturar($cliente_id);
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $pedidos,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function duplicate($factura_id = 0)
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$factura_origen = $this->model->find($factura_id);
|
||||
// se quita la key "id" del objeto
|
||||
unset($factura_origen->id);
|
||||
$factura_origen->estado = 'borrador';
|
||||
$factura_origen->estado_pago = 'pendiente';
|
||||
$factura_origen->base = 0;
|
||||
$factura_origen->total = 0;
|
||||
$factura_origen->pendiente = 0;
|
||||
$factura_origen->total_pagos = 0;
|
||||
$factura_origen->user_created_id = auth()->user()->id;
|
||||
$factura_origen->user_updated_id = null;
|
||||
|
||||
$this->model->insert($factura_origen);
|
||||
$id = $this->model->getInsertID();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'id' => $id,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTotales($factura_id = 0)
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$pendiente = $postData['pendiente'] ?? 0;
|
||||
$total = $postData['total'] ?? 0;
|
||||
|
||||
$data = [
|
||||
'base' => $postData['base'] ?? 0,
|
||||
'total' => $total,
|
||||
'pendiente' => $pendiente,
|
||||
'total_pagos' => $postData['total_pagos'] ?? 0,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
'estado_pago' => (intval($pendiente) == 0 && intval($total) != 0) ? 'pagada' : 'pendiente',
|
||||
];
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data_ret = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
if ($factura_id == 0) {
|
||||
return $this->respond($data_ret);
|
||||
}
|
||||
|
||||
$data_ret['estado_pago'] = $data['estado_pago'];
|
||||
$model = model('\App\Models\Facturas\FacturaModel');
|
||||
$model->update($factura_id, $data);
|
||||
|
||||
return $this->respond($data_ret);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function addExcedentes($factura_id)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$model_factura_linea = model('\App\Models\Facturas\FacturaLineaModel');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$cantidad = $postData['cantidad'] ?? 0;
|
||||
$precio_unidad = $postData['precio_unidad'] ?? 0;
|
||||
$iva = $postData['iva'] ?? 0;
|
||||
$descripcion = $postData['descripcion'] ?? '';
|
||||
$descuento = $postData['descuento'] ?? 0;
|
||||
$pedido_linea_impresion_id = $postData['pedido_linea_impresion_id'] ?? null;
|
||||
$pedido_linea_maquetacion_id = $postData['pedido_linea_maquetacion_id'] ?? null;
|
||||
$pedido_id = $postData['pedido_id'] ?? 0;
|
||||
|
||||
$nuevo_precio_unidad = round($precio_unidad * (100 - floatval($descuento)) / 100, 4);
|
||||
$base = round($cantidad * $nuevo_precio_unidad, 2);
|
||||
$total_iva = round($base * $iva / 100, 2);
|
||||
|
||||
$data = (object) [
|
||||
'factura_id' => $factura_id,
|
||||
'pedido_linea_impresion_id' => $pedido_linea_impresion_id,
|
||||
'pedido_linea_maquetacion_id' => $pedido_linea_maquetacion_id,
|
||||
'descripcion' => $newString = preg_replace_callback('/Impresión de (\d+) ejemplares/', function ($matches) use ($cantidad) {
|
||||
return 'Impresión de ' . $cantidad . ' ejemplares';
|
||||
}, $descripcion),
|
||||
'cantidad' => $cantidad,
|
||||
'precio_unidad' => $nuevo_precio_unidad,
|
||||
'iva' => $iva,
|
||||
'base' => $base,
|
||||
'total_iva' => $total_iva,
|
||||
'total' => round($base + $total_iva, 2),
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
];
|
||||
|
||||
$model_factura_linea->insert($data);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data_ret = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data_ret);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function addLineaPedidoImpresion($factura_id, $data = -1)
|
||||
{
|
||||
|
||||
if ($this->request) {
|
||||
if ($this->request->isAJAX())
|
||||
$pedido_linea_id = $this->request->getPost('lineaPedido') ?? 0;
|
||||
} else {
|
||||
if ($data == -1) {
|
||||
return "Error: sin datos";
|
||||
}
|
||||
$pedido_linea_id = $data;
|
||||
}
|
||||
|
||||
$model_pedido_linea = model('\App\Models\Pedidos\PedidoLineaModel');
|
||||
$model_presupuesto = model('\App\Models\Presupuestos\PresupuestoModel');
|
||||
$model_factura_linea = model('\App\Models\Facturas\FacturaLineaModel');
|
||||
$model_factura = model('\App\Models\Facturas\FacturaModel');
|
||||
|
||||
try {
|
||||
|
||||
$linea = $model_pedido_linea->find($pedido_linea_id);
|
||||
|
||||
$factura = $model_factura->find($factura_id);
|
||||
|
||||
if ($factura) {
|
||||
|
||||
if ($linea) {
|
||||
$presupuesto = $model_presupuesto->find($linea->presupuesto_id);
|
||||
|
||||
if ($presupuesto) {
|
||||
// Se añade la linea de factura
|
||||
$descripcion = $model_presupuesto->generarLineaPedido($presupuesto->id, true, $linea->pedido_id);
|
||||
$cantidad = intval($presupuesto->tirada) - intval($model_factura->getCantidadLineaPedidoFacturada($linea->id));
|
||||
$base =
|
||||
floatval($presupuesto->total_aceptado_revisado && $presupuesto->total_aceptado_revisado != 0 ?
|
||||
$presupuesto->total_aceptado_revisado : $presupuesto->total_aceptado);
|
||||
$base = round($base, 2);
|
||||
$total_iva = $base * ($presupuesto->iva_reducido == 1 ? 0.04 : 0.21);
|
||||
// se redondea a dos decimales
|
||||
$total_iva = round($total_iva, 2);
|
||||
$total = $base + $total_iva;
|
||||
|
||||
$data = (object) [
|
||||
'factura_id' => $factura_id,
|
||||
'pedido_linea_impresion_id' => $pedido_linea_id,
|
||||
'descripcion' => $descripcion[0]->concepto,
|
||||
'cantidad' => $cantidad,
|
||||
'iva' => $presupuesto->iva_reducido == 1 ? 4 : 21,
|
||||
'base' => $base,
|
||||
'total_iva' => $total_iva,
|
||||
'total' => $total,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
];
|
||||
|
||||
$model_factura_linea->insert($data);
|
||||
|
||||
$id = $model_factura_linea->getInsertID();
|
||||
|
||||
if ($id) {
|
||||
|
||||
$model_factura_linea->addFacturaPedidoLinea($factura_id, $linea->id, $cantidad);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$data = [
|
||||
'error' => 0,
|
||||
'id' => $id,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
if ($this->request) {
|
||||
if ($this->request->isAJAX())
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
// remove csrf token
|
||||
unset($data[$csrfTokenName]);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'error' => 1,
|
||||
'error_text' => $e->getMessage(),
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
if ($this->request) {
|
||||
if ($this->request->isAJAX())
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
unset($data[$csrfTokenName]);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteLineaPedidoImpresion()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$factura_id = $postData['factura_id'] ?? 0;
|
||||
$linea_id = $postData['linea_id'] ?? 0;
|
||||
$cantidad = $postData['cantidad'] ?? 0;
|
||||
|
||||
$model_factura_linea = model('\App\Models\Facturas\FacturaLineaModel');
|
||||
$model_factura_linea->deleteFacturasLineasPedido($factura_id, $linea_id, $cantidad);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteLineaPago()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$factura_id = $postData['factura_id'] ?? 0;
|
||||
$pago_id = $postData['pago_id'] ?? 0;
|
||||
|
||||
$model_factura_pago = model('\App\Models\Facturas\FacturaPagoModel');
|
||||
$model_factura_pago->update($pago_id, [
|
||||
'deleted_at' => date('Y-m-d H:i:s'),
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
]);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function validar($factura_id)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$factura = $this->model->find($factura_id);
|
||||
|
||||
if ($factura) {
|
||||
$model_series = model('\App\Models\Configuracion\SeriesFacturasModel');
|
||||
$numero = $model_series->getSerieNumerada($factura->serie_id);
|
||||
|
||||
$data = [
|
||||
'estado' => 'validada',
|
||||
'numero' => $numero,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
];
|
||||
|
||||
$this->model->update($factura_id, $data);
|
||||
|
||||
if ((strpos($numero, "REC ") === 0)) {
|
||||
|
||||
$this->model->where('numero', $factura->factura_rectificada_id)->set([
|
||||
'factura_rectificativa_id' => $numero,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
])->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updateCabecera($factura_id)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
if ($factura_id == 0) {
|
||||
return;
|
||||
}
|
||||
$factura = $this->model->find($factura_id);
|
||||
if ($factura) {
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$dataName = $postData['name'] ?? '';
|
||||
$dataValue = $postData['value'] ?? '';
|
||||
|
||||
if ($dataName == 'factura_rectificativa_id') {
|
||||
// se actualiza la factura donde el campo 'numero' sea igual al valor de $dataValue. El campo a actualizar es 'factura_rectificada_id'
|
||||
$factura_rectificada = $this->model->where('numero', $dataValue)->first();
|
||||
if ($factura_rectificada) {
|
||||
$data2 = [
|
||||
'factura_rectificada_id' => $factura->numero,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
];
|
||||
$this->model->update($factura_rectificada->id, $data2);
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
$dataName => $dataValue,
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
];
|
||||
|
||||
$this->model->update($factura_id, $data);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************
|
||||
* FUNCIONES AUXILIARES
|
||||
************************************/
|
||||
|
||||
private function obtenerDatosFormulario(&$factura)
|
||||
{
|
||||
|
||||
if ($factura->estado == 'borrador') {
|
||||
$serieModel = model('App\Models\Configuracion\SeriesFacturasModel');
|
||||
$serie = $serieModel->find($factura->serie_id);
|
||||
if ($serie) {
|
||||
$factura->numero = str_replace("{numero}", $serie->next, $serie->formato);
|
||||
}
|
||||
}
|
||||
|
||||
$clienteModel = model('App\Models\Clientes\ClienteModel');
|
||||
$cliente = $clienteModel->find($factura->cliente_id);
|
||||
$factura->cliente_alias = $cliente->alias;
|
||||
|
||||
$serieModel = model('App\Models\Configuracion\SeriesFacturasModel');
|
||||
$serie = $serieModel->find($factura->serie_id);
|
||||
$factura->serie_nombre = $serie->nombre;
|
||||
|
||||
$formaPagoModel = model('App\Models\Configuracion\FormaPagoModel');
|
||||
$factura->formas_pago = $formaPagoModel->getMenuItems();
|
||||
|
||||
$factura->fecha_factura_at_text = $factura->fecha_factura_at ? date('d/m/Y', strtotime($factura->fecha_factura_at)) : '';
|
||||
}
|
||||
|
||||
}
|
||||
262
ci4/app/Controllers/Facturacion/FacturasLineas.php
Executable file
262
ci4/app/Controllers/Facturacion/FacturasLineas.php
Executable file
@ -0,0 +1,262 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Facturacion;
|
||||
|
||||
use App\Models\Facturas\FacturaLineaModel;
|
||||
use App\Models\Collection;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
|
||||
class FacturasLineas extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
protected $modelName = FacturaLineaModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $controllerSlug = 'factura-lineas';
|
||||
|
||||
|
||||
public function datatable($factura_id = null)
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX() && $factura_id != null) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
|
||||
//$order = FacturaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$resourceData = $this->model->getResource($factura_id)->orderBy(1, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource($factura_id)->countAllResults(),
|
||||
$this->model->getResource($factura_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function deleteLinea($factura_linea_id = 0)
|
||||
{
|
||||
|
||||
if (!empty(static::$pluralObjectNameCc) && !empty(static::$singularObjectNameCc)) {
|
||||
$objName = mb_strtolower(lang(ucfirst(static::$pluralObjectNameCc) . '.' . static::$singularObjectNameCc));
|
||||
} else {
|
||||
$objName = lang('Basic.global.record');
|
||||
}
|
||||
|
||||
if ($factura_linea_id == 0) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
}
|
||||
|
||||
$facturaLinea = $this->model->find($factura_linea_id);
|
||||
if ($facturaLinea == null) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
}
|
||||
|
||||
if ($facturaLinea->pedido_linea_impresion_id != null) {
|
||||
$this->model->deleteFacturasLineasPedido($facturaLinea->factura_id, $facturaLinea->pedido_linea_impresion_id, $facturaLinea->cantidad);
|
||||
}
|
||||
|
||||
if ($facturaLinea->pedido_maquetacion_id != null) {
|
||||
//$this->model->deleteFacturasLineasPedido($facturaLinea->factura_id, $facturaLinea->pedido_maquetacion_id, $facturaLinea->cantidad);
|
||||
}
|
||||
|
||||
$facturaLinea = $this->model->delete($factura_linea_id);
|
||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||
$response = $this->respondDeleted(['id' => $factura_linea_id, 'msg' => $message]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
public function datatable_editor()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
|
||||
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst($db, 'facturas_lineas')
|
||||
->fields(
|
||||
Field::inst('id'),
|
||||
Field::inst('base'),
|
||||
Field::inst('total_iva'),
|
||||
Field::inst('total')->set(Field::SET_BOTH),
|
||||
Field::inst('cantidad')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
'message' => lang('Facturas.validation.numerico')
|
||||
)
|
||||
)
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('Facturas.validation.requerido')
|
||||
)
|
||||
),
|
||||
Field::inst('descripcion')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('Facturas.validation.requerido')
|
||||
)
|
||||
),
|
||||
Field::inst('iva')
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
'message' => lang('Facturas.validation.numerico')
|
||||
)
|
||||
)
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('Facturas.validation.requerido')
|
||||
)
|
||||
),
|
||||
Field::inst('pedido_linea_impresion_id')
|
||||
->setFormatter(function ($val, $data, $opts) {
|
||||
return $val === '' ? null : $val;
|
||||
}),
|
||||
Field::inst('pedido_maquetacion_id')
|
||||
->setFormatter(function ($val, $data, $opts) {
|
||||
return $val === '' ? null : $val;
|
||||
}),
|
||||
Field::inst('factura_id'),
|
||||
Field::inst('user_updated_id'),
|
||||
)
|
||||
->on('preCreate', function ($editor, &$values) {
|
||||
$totales = $this->generate_totales(
|
||||
$values['factura_id'],
|
||||
$values['pedido_linea_impresion_id'],
|
||||
$values['total'],
|
||||
$values['iva'],
|
||||
$values['cantidad'],
|
||||
$values['old_cantidad'],
|
||||
$values['base']
|
||||
);
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('base')
|
||||
->setValue($totales['base']);
|
||||
$editor
|
||||
->field('total_iva')
|
||||
->setValue($totales['total_iva']);
|
||||
$editor
|
||||
->field('total')
|
||||
->setValue($totales['total']);
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
})
|
||||
->on('preEdit', function ($editor, $id, &$values) {
|
||||
$totales = $this->generate_totales(
|
||||
$values['factura_id'],
|
||||
$values['pedido_linea_impresion_id'],
|
||||
$values['total'],
|
||||
$values['iva'],
|
||||
$values['cantidad'],
|
||||
$values['old_cantidad'],
|
||||
$values['base']
|
||||
);
|
||||
$editor
|
||||
->field('factura_id')
|
||||
->setValue($values['factura_id']);
|
||||
$editor
|
||||
->field('pedido_linea_impresion_id')
|
||||
->setValue(null);
|
||||
$editor
|
||||
->field('pedido_maquetacion_id')
|
||||
->setValue(null);
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('base')
|
||||
->setValue($totales['base']);
|
||||
$editor
|
||||
->field('total_iva')
|
||||
->setValue($totales['total_iva']);
|
||||
$editor
|
||||
->field('total')
|
||||
->setValue($totales['total']);
|
||||
})
|
||||
->debug(true)
|
||||
->process($_POST)
|
||||
->data();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$response[$csrfTokenName] = $newTokenHash;
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTotalesFactura($factura_id = 0)
|
||||
{
|
||||
if ($factura_id == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$model = model('\App\Models\Facturas\FacturaModel');
|
||||
$model->updateTotales($factura_id);
|
||||
}
|
||||
|
||||
private function generate_totales($factura_id, $pedido_linea_id, $total, $iva, $cantidad, $old_cantidad, $base_input)
|
||||
{
|
||||
|
||||
// si es una linea que se refiere a pedido
|
||||
if ($pedido_linea_id != null && $factura_id != null) {
|
||||
// se actualiza la cantidad de la linea de pedido en la tabla pivote facturas_pedidos_lineas
|
||||
$this->model->updateFacturaPedidoLinea($factura_id, $pedido_linea_id, $old_cantidad, $cantidad);
|
||||
}
|
||||
|
||||
// Si es una linea añadida a mano, el total y el iva tienen que venir metidos a mano
|
||||
if ($pedido_linea_id != null) {
|
||||
|
||||
// se calcula y se actualiza el subtotal, total_iva y total
|
||||
// redondeando a 4 decimales el precio_unidad y a dos el resto
|
||||
$precio_unidad = round($total / $old_cantidad, 4);
|
||||
$base = round($precio_unidad * $cantidad, 2);
|
||||
$total_iva = round($base * $iva / 100, 2);
|
||||
$total = round($base + $total_iva, 2);
|
||||
$values = [];
|
||||
$values['base'] = $base;
|
||||
$values['total_iva'] = $total_iva;
|
||||
$values['total'] = $total;
|
||||
} else {
|
||||
// se pasa la base y el iva
|
||||
$total_iva = round($base_input * $iva / 100, 2);
|
||||
$total = round($base_input + $total_iva, 2);
|
||||
|
||||
$values = [];
|
||||
$values['base'] = (float) $base_input;
|
||||
$values['total_iva'] = $total_iva;
|
||||
$values['total'] = $total;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
171
ci4/app/Controllers/Facturacion/FacturasPagos.php
Executable file
171
ci4/app/Controllers/Facturacion/FacturasPagos.php
Executable file
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Facturacion;
|
||||
|
||||
use App\Models\Facturas\FacturaPagoModel;
|
||||
use App\Models\Collection;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
use DataTables\Editor\Format;
|
||||
|
||||
class FacturasPagos extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
protected $modelName = FacturaPagoModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $controllerSlug = 'factura-pagos';
|
||||
|
||||
|
||||
public function datatable($factura_id = null){
|
||||
|
||||
if ($this->request->isAJAX() && $factura_id != null) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
|
||||
//$order = FacturaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$resourceData = $this->model->getResource($factura_id)->orderBy(1, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource($factura_id)->countAllResults(),
|
||||
$this->model->getResource($factura_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function datatable_editor() {
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
|
||||
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst( $db, 'facturas_pagos' )
|
||||
->fields(
|
||||
Field::inst( 'id' ),
|
||||
Field::inst( 'forma_pago_id' ),
|
||||
Field::inst( 'notes' ),
|
||||
Field::inst( 'fecha_pago_at' )
|
||||
->validator( Validate::dateFormat( 'Y-m-d H:i:s' ) )
|
||||
->getFormatter( Format::dateSqlToFormat( 'Y-m-d H:i:s' ) )
|
||||
->setFormatter( Format::dateFormatToSql( 'Y-m-d H:i:s' ) ),
|
||||
Field::inst( 'fecha_vencimiento_at' )
|
||||
->validator( Validate::dateFormat( 'Y-m-d H:i:s' ) )
|
||||
->getFormatter( Format::dateSqlToFormat( 'Y-m-d H:i:s' ) )
|
||||
->setFormatter( Format::dateFormatToSql( 'Y-m-d H:i:s' ) ),
|
||||
Field::inst( 'total' )
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('Facturas.validation.numerico'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('Facturas.validation.requerido'))
|
||||
),
|
||||
Field::inst( 'factura_id' ),
|
||||
Field::inst( 'user_updated_id' ),
|
||||
)
|
||||
->on('preCreate', function ($editor, &$values) {
|
||||
/*
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('base')
|
||||
->setValue($totales['base']);
|
||||
$editor
|
||||
->field('total_iva')
|
||||
->setValue($totales['total_iva']);
|
||||
$editor
|
||||
->field('total')
|
||||
->setValue($totales['total']);
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
*/
|
||||
})
|
||||
->on('preEdit', function ($editor, $id, &$values) {
|
||||
/*
|
||||
$editor
|
||||
->field('factura_id')
|
||||
->setValue($values['factura_id']);
|
||||
$editor
|
||||
->field('pedido_linea_impresion_id')
|
||||
->setValue(null);
|
||||
$editor
|
||||
->field('pedido_maquetacion_id')
|
||||
->setValue(null);
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
$editor
|
||||
->field('base')
|
||||
->setValue($totales['base']);
|
||||
$editor
|
||||
->field('total_iva')
|
||||
->setValue($totales['total_iva']);
|
||||
$editor
|
||||
->field('total')
|
||||
->setValue($totales['total']);
|
||||
*/
|
||||
})
|
||||
->debug(true)
|
||||
->process($_POST)
|
||||
->data();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$response[$csrfTokenName] = $newTokenHash;
|
||||
|
||||
echo json_encode($response);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function addPagoRectificativa()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$data['factura_id'] = $this->request->getPost('factura_id');
|
||||
$data['fecha_vencimiento_at'] = $this->request->getPost('fecha');
|
||||
$data['total'] = $this->request->getPost('total');
|
||||
$data['user_updated_id'] = auth()->user()->id;
|
||||
$data['forma_pago_id'] = 6; // compensada
|
||||
|
||||
if($data['fecha_vencimiento_at'] != null && $data['fecha_vencimiento_at'] != '') {
|
||||
$data['fecha_vencimiento_at'] = date('Y-m-d H:i:s', strtotime($data['fecha_vencimiento_at']));
|
||||
}
|
||||
|
||||
$model = new FacturaPagoModel();
|
||||
$model->insert($data);
|
||||
|
||||
$modelFactura = model('App\Models\Facturas\FacturaModel');
|
||||
$modelFactura->update($data['factura_id'], [
|
||||
'estado_pago' => 'pagada',
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'user_updated_id' => auth()->user()->id,
|
||||
]);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'message' => lang('Facturas.facturaConformada'),
|
||||
]);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -17,10 +17,10 @@ namespace App\Controllers;
|
||||
*/
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\Database\Query;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
|
||||
abstract class GoBaseController extends Controller {
|
||||
abstract class GoBaseController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
@ -102,7 +102,7 @@ abstract class GoBaseController extends Controller {
|
||||
* @var array
|
||||
*/
|
||||
public $viewData;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* JJO: Variable para indicar si el controlador hace soft_delete o no
|
||||
@ -139,14 +139,15 @@ abstract class GoBaseController extends Controller {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $helpers = ['session', 'go_common', 'text', 'general','jwt']; //JJO
|
||||
protected $helpers = ['session', 'go_common', 'text', 'general', 'jwt', 'rbac']; //JJO
|
||||
|
||||
public static $queries = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
// Do Not Edit This Line
|
||||
parent::initController($request, $response, $logger);
|
||||
|
||||
@ -155,9 +156,9 @@ abstract class GoBaseController extends Controller {
|
||||
//--------------------------------------------------------------------
|
||||
// E.g.:
|
||||
$this->session = \Config\Services::session();
|
||||
|
||||
|
||||
if ((!isset($this->viewData['pageTitle']) || empty($this->viewData['pageTitle']) ) && isset(static::$pluralObjectName) && !empty(static::$pluralObjectName)) {
|
||||
|
||||
if ((!isset($this->viewData['pageTitle']) || empty($this->viewData['pageTitle'])) && isset(static::$pluralObjectName) && !empty(static::$pluralObjectName)) {
|
||||
$this->viewData['pageTitle'] = ucfirst(static::$pluralObjectName);
|
||||
}
|
||||
|
||||
@ -171,7 +172,7 @@ abstract class GoBaseController extends Controller {
|
||||
if (empty(static::$controllerSlug)) {
|
||||
$reflect = new \ReflectionClass($this);
|
||||
$className = $reflect->getShortName();
|
||||
$this->viewData['currentModule'] = slugify(convertToSnakeCase(str_replace('Controller','',$className)));
|
||||
$this->viewData['currentModule'] = slugify(convertToSnakeCase(str_replace('Controller', '', $className)));
|
||||
|
||||
} else {
|
||||
$this->viewData['currentModule'] = strtolower(static::$controllerSlug);
|
||||
@ -185,43 +186,31 @@ abstract class GoBaseController extends Controller {
|
||||
$this->model = &$this->primaryModel;
|
||||
}
|
||||
|
||||
// Preload any models, libraries, etc, here.
|
||||
// Preload any models, libraries, etc, here.
|
||||
|
||||
|
||||
|
||||
// Language Validate
|
||||
$language = \Config\Services::language();
|
||||
$language->setLocale($this->session->lang);
|
||||
|
||||
// Set TimeZone
|
||||
if(empty($this->session->get('settings'))){
|
||||
$settingsModel = new SettingsModel();
|
||||
$settings = $settingsModel->select('default_timezone')->first()??[];
|
||||
date_default_timezone_set($this->$settings['default_timezone']??'America/Sao_Paulo');
|
||||
}else{
|
||||
date_default_timezone_set($this->session->get('settings')['default_timezone']??'America/Sao_Paulo');
|
||||
if (empty($this->session->get('settings'))) {
|
||||
$time_zone = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('default_timezone')->value;
|
||||
date_default_timezone_set($time_zone ?? 'Europe/Madrid');
|
||||
} else {
|
||||
date_default_timezone_set($this->session->get('settings')['default_timezone'] ?? 'Europe/Madrid');
|
||||
}
|
||||
|
||||
// Get notification
|
||||
if(!empty($this->session->get('token'))) {
|
||||
$notificationModel = new NotificationModel();
|
||||
$pulse = $notificationModel->where('user_recipient',$this->session->get('token'))->where('is_read',false)->countAllResults() ?? 0;
|
||||
$notification = $notificationModel->select('token,title,is_read,created_at')->where('user_recipient',$this->session->get('token'))->orderBy('created_at','desc')->findAll(5) ?? [];
|
||||
$this->session->set('notification', $notification);
|
||||
$this->session->set('pulse', $pulse);
|
||||
}else{
|
||||
$this->session->set('notification', []);
|
||||
$this->session->set('pulse', 0);
|
||||
}
|
||||
|
||||
$this->viewData['currentLocale'] = $this->request->getLocale();
|
||||
|
||||
}
|
||||
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
|
||||
helper('text');
|
||||
|
||||
if ((!isset($this->viewData['boxTitle']) || empty($this->viewData['boxTitle']) ) && isset(static::$pluralObjectName) && !empty(static::$pluralObjectName)) {
|
||||
if ((!isset($this->viewData['boxTitle']) || empty($this->viewData['boxTitle'])) && isset(static::$pluralObjectName) && !empty(static::$pluralObjectName)) {
|
||||
$this->viewData['boxTitle'] = ucfirst(static::$pluralObjectName);
|
||||
}
|
||||
|
||||
@ -236,10 +225,10 @@ abstract class GoBaseController extends Controller {
|
||||
|
||||
// if $this->currentView is assigned a view name, use it, otherwise assume the view something like 'viewSingleObjectList'
|
||||
$viewFilePath = static::$viewPath . (empty($this->currentView) ? 'view' . ucfirst(static::$singularObjectNameCc) . 'List' : $this->currentView);
|
||||
|
||||
|
||||
echo view($viewFilePath, $this->viewData);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -248,12 +237,13 @@ abstract class GoBaseController extends Controller {
|
||||
* @param null $objId
|
||||
* @return string
|
||||
*/
|
||||
protected function displayForm($forMethod, $objId = null) {
|
||||
protected function displayForm($forMethod, $objId = null)
|
||||
{
|
||||
|
||||
helper('form');
|
||||
$this->viewData['usingSelect2'] = true;
|
||||
|
||||
$validation = \Config\Services::validation();
|
||||
|
||||
$validation = \Config\Services::validation();
|
||||
|
||||
$action = str_replace(static::class . '::', '', $forMethod);
|
||||
$actionSuffix = ' ';
|
||||
@ -270,13 +260,13 @@ abstract class GoBaseController extends Controller {
|
||||
}
|
||||
|
||||
if (!isset($this->viewData['formAction'])) {
|
||||
$this->viewData['formAction'] = base_url(strtolower($this->viewData['currentModule']) . '/' . $action . '/' . $formActionSuffix);
|
||||
$this->viewData['formAction'] = base_url(strtolower($this->viewData['currentModule']) . '/' . $action . '/' . $formActionSuffix);
|
||||
}
|
||||
|
||||
if ((!isset($this->viewData['boxTitle']) || empty($this->viewData['boxTitle']) ) && isset(static::$singularObjectName) && !empty(static::$singularObjectName)) {
|
||||
if ((!isset($this->viewData['boxTitle']) || empty($this->viewData['boxTitle'])) && isset(static::$singularObjectName) && !empty(static::$singularObjectName)) {
|
||||
$this->viewData['boxTitle'] = ucfirst($action) . $actionSuffix . ucfirst(static::$singularObjectName);
|
||||
}
|
||||
|
||||
|
||||
$this->viewData['validation'] = $validation;
|
||||
|
||||
$viewFilePath = static::$viewPath . 'view' . ucfirst(static::$singularObjectNameCc) . 'Form';
|
||||
@ -284,7 +274,8 @@ abstract class GoBaseController extends Controller {
|
||||
return view($viewFilePath, $this->viewData);
|
||||
}
|
||||
|
||||
protected function redirect2listView($flashDataKey = null, $flashDataValue = null) {
|
||||
protected function redirect2listView($flashDataKey = null, $flashDataValue = null)
|
||||
{
|
||||
|
||||
if (!empty($this->indexRoute)) {
|
||||
$uri = base_url(route_to($this->indexRoute));
|
||||
@ -304,9 +295,9 @@ abstract class GoBaseController extends Controller {
|
||||
} else {
|
||||
$getHandlingRoutes = $routes->getRoutes('get');
|
||||
|
||||
$indexMethod = array_search('\\App\\Controllers\\'.$className.'::index', $getHandlingRoutes);
|
||||
$indexMethod = array_search('\\App\\Controllers\\' . $className . '::index', $getHandlingRoutes);
|
||||
if ($indexMethod) {
|
||||
$uri = route_to('App\\Controllers\\'.$className.'::index');
|
||||
$uri = route_to('App\\Controllers\\' . $className . '::index');
|
||||
} else {
|
||||
$uri = base_url(static::$controllerSlug);
|
||||
}
|
||||
@ -315,7 +306,7 @@ abstract class GoBaseController extends Controller {
|
||||
$uri = base_url($className);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($flashDataKey != null && $flashDataValue != null) {
|
||||
return redirect()->to($uri)->with($flashDataKey, $flashDataValue);
|
||||
} else {
|
||||
@ -323,10 +314,11 @@ abstract class GoBaseController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($requestedId, bool $deletePermanently = true) {
|
||||
public function delete($requestedId, bool $deletePermanently = true)
|
||||
{
|
||||
|
||||
if (is_string($requestedId)) :
|
||||
if (is_numeric($requestedId)) :
|
||||
if (is_string($requestedId)):
|
||||
if (is_numeric($requestedId)):
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_NUMBER_INT);
|
||||
else:
|
||||
$onlyAlphaNumeric = true;
|
||||
@ -338,64 +330,66 @@ abstract class GoBaseController extends Controller {
|
||||
$id = intval($requestedId);
|
||||
endif;
|
||||
|
||||
if (empty($id) || $id === 0) :
|
||||
if (empty($id) || $id === 0):
|
||||
$error = 'Invalid identifier provided to delete the object.';
|
||||
endif;
|
||||
|
||||
$rawResult = null;
|
||||
|
||||
if (!isset($error)) :
|
||||
if (!isset($error)):
|
||||
try {
|
||||
if ($deletePermanently && !$this->soft_delete) :
|
||||
if (is_numeric($id)) :
|
||||
$rawResult = $this->primaryModel->delete($id);
|
||||
else:
|
||||
$rawResult = $this->primaryModel->where($this->primaryModel->getPrimaryKeyName(), $id)->delete();
|
||||
endif;
|
||||
elseif ($this->soft_delete):
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$rawResult = $this->primaryModel->where('id',$id)
|
||||
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'is_deleted' => $this->delete_flag])
|
||||
->update();
|
||||
if ($deletePermanently && !$this->soft_delete):
|
||||
if (is_numeric($id)):
|
||||
$rawResult = $this->primaryModel->delete($id);
|
||||
else:
|
||||
$rawResult = $this->primaryModel->where($this->primaryModel->getPrimaryKeyName(), $id)->delete();
|
||||
endif;
|
||||
elseif ($this->soft_delete):
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$rawResult = $this->primaryModel->where('id', $id)
|
||||
->set([
|
||||
'deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'is_deleted' => $this->delete_flag
|
||||
])
|
||||
->update();
|
||||
|
||||
else:
|
||||
$rawResult = $this->primaryModel->update($id, ['deleted' => true]);
|
||||
endif;
|
||||
else:
|
||||
$rawResult = $this->primaryModel->update($id, ['deleted' => true]);
|
||||
endif;
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "Exception: Error deleting object named '".(static::$singularObjectName ?? 'unknown')."' with $id :\r\n".$e->getMessage());
|
||||
log_message('error', "Exception: Error deleting object named '" . (static::$singularObjectName ?? 'unknown') . "' with $id :\r\n" . $e->getMessage());
|
||||
}
|
||||
endif;
|
||||
|
||||
$ar = $this->primaryModel->db->affectedRows();
|
||||
|
||||
|
||||
try {
|
||||
$dbError = $this->primaryModel->db->error();
|
||||
} catch (\Exception $e2) {
|
||||
if ($e2->getMessage() != "Trying to get property 'errno' of non-object") {
|
||||
log_message('error', $e2->getCode() . ' : ' . $e2->getMessage()) ;
|
||||
log_message('error', $e2->getCode() . ' : ' . $e2->getMessage());
|
||||
}
|
||||
}
|
||||
if (isset($dbError['code']) && isset($dbError['message'])) {
|
||||
log_message('error', $dbError['code'].' '.$dbError['message']);
|
||||
log_message('error', $dbError['code'] . ' ' . $dbError['message']);
|
||||
} else {
|
||||
$dbError = ['code' => '', 'message'=>''];
|
||||
$dbError = ['code' => '', 'message' => ''];
|
||||
}
|
||||
|
||||
$result = ['persisted'=>$ar>0, 'ar'=>$ar, 'persistedId'=>null, 'affectedRows'=>$ar, 'errorCode'=>$dbError['code'], 'error'=>$dbError['message']];
|
||||
|
||||
$result = ['persisted' => $ar > 0, 'ar' => $ar, 'persistedId' => null, 'affectedRows' => $ar, 'errorCode' => $dbError['code'], 'error' => $dbError['message']];
|
||||
|
||||
$nameOfDeletedObject = static::$singularObjectNameCc;
|
||||
|
||||
if ($ar < 1) :
|
||||
|
||||
if ($ar < 1):
|
||||
$errorMessage = lang('Basic.global.deleteError', [$nameOfDeletedObject]); // 'No ' . static::$singularObjectName . ' was deleted now, because it probably had already been deleted.';
|
||||
$fdKey = isset($this->viewData['usingSweetAlert'] ) && $this->viewData['usingSweetAlert'] ? 'sweet-error' : 'errorMessage';
|
||||
$fdKey = isset($this->viewData['usingSweetAlert']) && $this->viewData['usingSweetAlert'] ? 'sweet-error' : 'errorMessage';
|
||||
$errorMessage = str_replace("'", "\'", $errorMessage);
|
||||
return $this->redirect2listView($fdKey, str_replace("'", '', $errorMessage));
|
||||
else:
|
||||
$message = lang('Basic.global.deleteSuccess', [$nameOfDeletedObject]); // 'The ' . static::$singularObjectName . ' was successfully deleted.';
|
||||
$fdKey = isset($this->viewData['usingSweetAlert'] ) && $this->viewData['usingSweetAlert'] ? 'sweet-success' : 'successMessage';
|
||||
if ($result['affectedRows']>1) :
|
||||
log_message('warning', "More than one row has been deleted in attempt to delete row for object named '".(static::$singularObjectName ?? 'unknown')."' with id: $id");
|
||||
$fdKey = isset($this->viewData['usingSweetAlert']) && $this->viewData['usingSweetAlert'] ? 'sweet-success' : 'successMessage';
|
||||
if ($result['affectedRows'] > 1):
|
||||
log_message('warning', "More than one row has been deleted in attempt to delete row for object named '" . (static::$singularObjectName ?? 'unknown') . "' with id: $id");
|
||||
endif;
|
||||
$message = str_replace("'", "\'", $message);
|
||||
return $this->redirect2listView($fdKey, $message);
|
||||
@ -403,7 +397,7 @@ abstract class GoBaseController extends Controller {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Convenience method to validate form submission
|
||||
* @return bool
|
||||
*/
|
||||
@ -416,14 +410,15 @@ abstract class GoBaseController extends Controller {
|
||||
return true;
|
||||
}
|
||||
|
||||
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;;
|
||||
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;
|
||||
;
|
||||
|
||||
if ($validationErrorMessages != null) {
|
||||
$valid = $this->validate($validationRules, $validationErrorMessages);
|
||||
} else {
|
||||
$valid = $this->validate($validationRules);
|
||||
}
|
||||
|
||||
|
||||
$this->validationErrors = $valid ? '' : $this->validator->getErrors();
|
||||
|
||||
/*
|
||||
@ -443,7 +438,8 @@ abstract class GoBaseController extends Controller {
|
||||
* @param array|null $postData
|
||||
* @return array
|
||||
*/
|
||||
protected function sanitized(array $postData = null, bool $nullIfEmpty = false) {
|
||||
protected function sanitized(array $postData = null, bool $nullIfEmpty = false)
|
||||
{
|
||||
if ($postData == null) {
|
||||
$postData = $this->request->getPost();
|
||||
}
|
||||
@ -462,29 +458,31 @@ abstract class GoBaseController extends Controller {
|
||||
* Convenience method for common exception handling
|
||||
* @param \Exception $e
|
||||
*/
|
||||
protected function dealWithException(\Exception $e) {
|
||||
protected function dealWithException(\Exception $e)
|
||||
{
|
||||
// using another try / catch block to prevent to avoid CodeIgniter bug throwing trivial exceptions for querying DB errors
|
||||
try {
|
||||
$query = $this->model->db->getLastQuery();
|
||||
$queryStr = !is_null($query) ? $query->getQuery() : '';
|
||||
$dbError = $this->model->db->error();
|
||||
$userFriendlyErrMsg = lang('Basic.global.persistErr1', [static::$singularObjectNameCc]);
|
||||
if (isset($dbError['code']) && $dbError['code'] == 1062) :
|
||||
$userFriendlyErrMsg .= PHP_EOL.lang('Basic.global.persistDuplErr', [static::$singularObjectNameCc]);
|
||||
if (isset($dbError['code']) && $dbError['code'] == 1062):
|
||||
$userFriendlyErrMsg .= PHP_EOL . lang('Basic.global.persistDuplErr', [static::$singularObjectNameCc]);
|
||||
endif;
|
||||
// $userFriendlyErrMsg = str_replace("'", "\'", $userFriendlyErrMsg); // Uncomment if experiencing unescaped single quote errors
|
||||
log_message('error', $userFriendlyErrMsg.PHP_EOL.$e->getMessage().PHP_EOL.$queryStr);
|
||||
if (isset($dbError['message']) && !empty($dbError['message'])) :
|
||||
log_message('error', $dbError['code'].' : '.$dbError['message']);
|
||||
log_message('error', $userFriendlyErrMsg . PHP_EOL . $e->getMessage() . PHP_EOL . $queryStr);
|
||||
if (isset($dbError['message']) && !empty($dbError['message'])):
|
||||
log_message('error', $dbError['code'] . ' : ' . $dbError['message']);
|
||||
endif;
|
||||
$this->viewData['errorMessage'] = $userFriendlyErrMsg;
|
||||
} catch (\Exception $e2) {
|
||||
log_message('debug', 'You can probably safely ignore this: In attempt to check DB errors, CodeIgniter threw: '.PHP_EOL.$e2->getMessage());
|
||||
log_message('debug', 'You can probably safely ignore this: In attempt to check DB errors, CodeIgniter threw: ' . PHP_EOL . $e2->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Collect the queries so something can be done with them later.
|
||||
public static function collect(Query $query) {
|
||||
public static function collect(Query $query)
|
||||
{
|
||||
static::$queries[] = $query;
|
||||
}
|
||||
|
||||
@ -495,7 +493,8 @@ abstract class GoBaseController extends Controller {
|
||||
* @param object $sourceObject
|
||||
* @return object
|
||||
*/
|
||||
function cast($destination, $sourceObject) {
|
||||
function cast($destination, $sourceObject)
|
||||
{
|
||||
if (is_string($destination)) {
|
||||
$destination = new $destination();
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ class Home extends BaseController
|
||||
public function index()
|
||||
{
|
||||
|
||||
echo view(getenv('theme.path') . 'main/defaultlayout');
|
||||
echo view(getenv('theme.path') . 'form/home/viewHome');
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user