Dashboard sipadu mbip
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

CompoundController.php 49KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  1. <?php
  2. namespace App\Http\Controllers\Main;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use Illuminate\Support\Facades\Auth;
  6. use Carbon\Carbon;
  7. use App\SiteSetting;
  8. use App\Model\Staff;
  9. use App\Model\StaffDetail;
  10. use App\Model\User;
  11. use App\Model\UserDetail;
  12. use App\Model\Module\Roles;
  13. use App\Model\Module\Department;
  14. use App\Model\Module\DeedLaw;
  15. use App\Model\Module\Faulty;
  16. use App\Model\Module\Compound;
  17. use App\Model\Module\CodeMukim;
  18. use App\Model\Module\CompoundInvestigation;
  19. use App\Model\Module\ConfidentialFile;
  20. use App\Model\Module\History;
  21. use App\Model\Module\SubHistory;
  22. use App\Model\Module\Memo;
  23. use App\Model\Module\Attachment;
  24. use App\Model\Module\ReportOverallCompound;
  25. use App\Jobs\StoreCompound;
  26. use App\Jobs\StoreCompoundManual;
  27. use App\Jobs\StoreCompoundEPBT;
  28. use App\Jobs\UpdateCompoundPrice;
  29. class CompoundController extends Controller
  30. {
  31. /**
  32. * Create compound list interface controller.
  33. *
  34. * @return json
  35. */
  36. public function index(){
  37. $id = Auth::guard('sadmin')->id();
  38. $user = Staff::with('StaffDetail')->find($id);
  39. if(count($user->StaffDetail->department_ids) > 1){
  40. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  41. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  42. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  43. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  44. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  45. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  46. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  47. }else {
  48. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  49. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  50. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  51. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  52. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  53. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  54. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  55. }
  56. $semua = $overall->total;
  57. $pre_notice = $n->total;
  58. $baru = $b->total;
  59. $invest = $pk->total;
  60. $notice = $na->total;
  61. $inven = $si->total;
  62. $collap = 0;
  63. $comp = $by->total;
  64. $site = SiteSetting::first();
  65. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  66. $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  67. $now = Carbon::now()->format('Y-m-d');
  68. $modul = 'All';
  69. return view('main-dashboard.compound.compound_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp'));
  70. }
  71. public function preNoticeIndex(){
  72. $id = Auth::guard('sadmin')->id();
  73. $user = Staff::with('StaffDetail')->find($id);
  74. if(count($user->StaffDetail->department_ids) > 1){
  75. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  76. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  77. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  78. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  79. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  80. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  81. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  82. }else {
  83. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  84. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  85. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  86. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  87. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  88. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  89. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  90. }
  91. $semua = $overall->total;
  92. $pre_notice = $n->total;
  93. $baru = $b->total;
  94. $invest = $pk->total;
  95. $notice = $na->total;
  96. $inven = $si->total;
  97. $collap = 0;
  98. $comp = $by->total;
  99. $site = SiteSetting::first();
  100. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  101. $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  102. $now = Carbon::now()->format('Y-m-d');
  103. $modul = '02';
  104. return view('main-dashboard.compound.prenotice_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp'));
  105. }
  106. public function new_index(){
  107. $id = Auth::guard('sadmin')->id();
  108. $user = Staff::with('StaffDetail')->find($id);
  109. if(count($user->StaffDetail->department_ids) > 1){
  110. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  111. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  112. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  113. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  114. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  115. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  116. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  117. }else {
  118. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  119. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  120. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  121. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  122. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  123. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  124. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  125. }
  126. $semua = $overall->total;
  127. $pre_notice = $n->total;
  128. $baru = $b->total;
  129. $invest = $pk->total;
  130. $notice = $na->total;
  131. $inven = $si->total;
  132. $collap = 0;
  133. $comp = $by->total;
  134. $site = SiteSetting::first();
  135. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  136. $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  137. $now = Carbon::now()->format('Y-m-d');
  138. $modul = '03';
  139. return view('main-dashboard.compound.new_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp'));
  140. }
  141. public function investigation_index(){
  142. $id = Auth::guard('sadmin')->id();
  143. $user = Staff::with('StaffDetail')->find($id);
  144. if(count($user->StaffDetail->department_ids) > 1){
  145. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  146. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  147. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  148. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  149. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  150. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  151. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  152. }else {
  153. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  154. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  155. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  156. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  157. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  158. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  159. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  160. }
  161. $semua = $overall->total;
  162. $pre_notice = $n->total;
  163. $baru = $b->total;
  164. $invest = $pk->total;
  165. $notice = $na->total;
  166. $inven = $si->total;
  167. $collap = 0;
  168. $comp = $by->total;
  169. $site = SiteSetting::first();
  170. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  171. $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  172. $now = Carbon::now()->format('Y-m-d');
  173. $modul = '04';
  174. return view('main-dashboard.compound.investigation_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp'));
  175. }
  176. public function notice_index(){
  177. $id = Auth::guard('sadmin')->id();
  178. $user = Staff::with('StaffDetail')->find($id);
  179. if(count($user->StaffDetail->department_ids) > 1){
  180. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  181. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  182. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  183. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  184. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  185. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  186. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  187. }else {
  188. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  189. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  190. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  191. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  192. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  193. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  194. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  195. }
  196. $semua = $overall->total;
  197. $pre_notice = $n->total;
  198. $baru = $b->total;
  199. $invest = $pk->total;
  200. $notice = $na->total;
  201. $inven = $si->total;
  202. $collap = 0;
  203. $comp = $by->total;
  204. $site = SiteSetting::first();
  205. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  206. $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  207. $now = Carbon::now()->format('Y-m-d');
  208. $modul = '05';
  209. return view('main-dashboard.compound.notice_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp'));
  210. }
  211. public function confiscated_index(){
  212. $id = Auth::guard('sadmin')->id();
  213. $user = Staff::with('StaffDetail')->find($id);
  214. if(count($user->StaffDetail->department_ids) > 1){
  215. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  216. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  217. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  218. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  219. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  220. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  221. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  222. }else {
  223. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  224. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  225. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  226. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  227. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  228. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  229. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  230. }
  231. $semua = $overall->total;
  232. $pre_notice = $n->total;
  233. $baru = $b->total;
  234. $invest = $pk->total;
  235. $notice = $na->total;
  236. $inven = $si->total;
  237. $collap = 0;
  238. $comp = $by->total;
  239. $site = SiteSetting::first();
  240. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  241. $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  242. $now = Carbon::now()->format('Y-m-d');
  243. $modul = '06-07';
  244. return view('main-dashboard.compound.confiscated_index', compact('user','site','staff','deedlaw','now','modul','semua','pre_notice','baru','invest','notice','inven','collap','comp'));
  245. }
  246. public function collapsed_index(){
  247. $id = Auth::guard('sadmin')->id();
  248. $user = Staff::with('StaffDetail')->find($id);
  249. if(count($user->StaffDetail->department_ids) > 1){
  250. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  251. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  252. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  253. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  254. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  255. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  256. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  257. }else {
  258. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  259. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  260. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  261. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  262. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  263. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  264. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  265. }
  266. $semua = $overall->total;
  267. $pre_notice = $n->total;
  268. $baru = $b->total;
  269. $invest = $pk->total;
  270. $notice = $na->total;
  271. $inven = $si->total;
  272. $collap = 0;
  273. $comp = $by->total;
  274. $site = SiteSetting::first();
  275. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  276. $faulty = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  277. return view('main-dashboard.compound.collapsed_index', compact('user','site','staff','faulty','pre_notice','baru','invest','notice','inven','collap','comp'));
  278. }
  279. public function completed_index(){
  280. $id = Auth::guard('sadmin')->id();
  281. $user = Staff::with('StaffDetail')->find($id);
  282. if(count($user->StaffDetail->department_ids) > 1){
  283. $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
  284. $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
  285. $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
  286. $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
  287. $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
  288. $si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
  289. $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
  290. }else {
  291. $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
  292. $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
  293. $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
  294. $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
  295. $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
  296. $si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
  297. $by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
  298. }
  299. $semua = $overall->total;
  300. $pre_notice = $n->total;
  301. $baru = $b->total;
  302. $invest = $pk->total;
  303. $notice = $na->total;
  304. $inven = $si->total;
  305. $collap = 0;
  306. $comp = $by->total;
  307. $site = SiteSetting::first();
  308. $staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  309. $deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
  310. $now = Carbon::now()->format('Y-m-d');
  311. $modul = 'All';
  312. return view('main-dashboard.compound.completed_index', compact('user','site','staff','deedlaw','now','modul','semua', 'pre_notice','baru','invest','notice','inven','collap','comp'));
  313. }
  314. public function viewCompoundHistoryDetail($kpd){
  315. $id = Auth::guard('sadmin')->id();
  316. $user = Staff::with('StaffDetail')->find($id);
  317. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non',$kpd)->first();
  318. if(empty($compound))
  319. {
  320. $kpd = (int)$kpd;
  321. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non',$kpd)->first();
  322. }
  323. $file = ConfidentialFile::with('History','History.SubHistory')->where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  324. $role = Roles::where('kod',$file->modul)->first();
  325. $site = SiteSetting::first();
  326. return view('main-dashboard.compound_detail.history_detail', compact('user','compound','file','role','site'));
  327. }
  328. public function viewCompoundDetail($kpd){
  329. $id = Auth::guard('sadmin')->id();
  330. $user = Staff::with('StaffDetail')->find($id);
  331. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non',$kpd)->first();
  332. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  333. $faulty = Faulty::with(['DeedLaw' => function($q){
  334. $q->with('Department');
  335. }])->where('_id',$compound->seksyen_kesalahan)->first();
  336. $role = Roles::where('kod',$compound->modul)->first();
  337. $enforcer = '';
  338. $site = SiteSetting::first();
  339. $enforcer = Staff::with('StaffDetail')->where('_id',$compound->dikeluarkan)->first();
  340. return view('main-dashboard.compound_detail.compound_detail', compact('user','compound','file','faulty','role','enforcer','site'));
  341. }
  342. public function viewCompoundMemoDetail($kpd){
  343. $id = Auth::guard('sadmin')->id();
  344. $user = Staff::with('StaffDetail')->find($id);
  345. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
  346. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  347. $roles = Roles::all();
  348. $role = Roles::where('kod',$compound->modul)->first();
  349. $site = SiteSetting::first();
  350. return view('main-dashboard.compound_detail.memo_detail', compact('user','compound','file','roles','role','site'));
  351. }
  352. public function viewCompoundEditMemoDetail($kpd, $memo){
  353. $id = Auth::guard('sadmin')->id();
  354. $user = Staff::with('StaffDetail')->find($id);
  355. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
  356. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  357. $memo = Memo::where('_id',$memo)->first();
  358. $roles = Roles::all();
  359. $role = Roles::where('kod',$compound->modul)->first();
  360. $site = SiteSetting::first();
  361. return view('main-dashboard.compound_detail.compound_memo_edit', compact('user','compound','file','roles','role','memo','site'));
  362. }
  363. public function viewCompoundInvestigationDetail($kpd){
  364. $id = Auth::guard('sadmin')->id();
  365. $user = Staff::with('StaffDetail')->find($id);
  366. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
  367. $investigation = Compound::with('CompoundInvestigation')->where('kpd',$kpd)->first();
  368. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  369. $faulty = Faulty::where('_id',$compound->seksyen_kesalahan)->first();
  370. $akta = DeedLaw::where('akkod',$faulty->akkod)->first();
  371. $role = Roles::where('kod',$compound->modul)->first();
  372. $total = ''; $enforcer = '';
  373. if($compound->jumlah_kemaskini_kompaun == ''){
  374. $total = $compound->jumlah_asal_kompaun;
  375. }else{
  376. $total = $compound->jumlah_kemaskini_kompaun;
  377. }
  378. $site = SiteSetting::first();
  379. $enforcer = Staff::with('StaffDetail')->where('_id',$compound->dikeluarkan)->first();
  380. return view('main-dashboard.compound_detail.investigation_detail', compact('user','compound','investigation','file','akta','faulty','role','total','enforcer','site'));
  381. }
  382. public function viewCompoundNoticeDetail($kpd){
  383. $id = Auth::guard('sadmin')->id();
  384. $user = Staff::with('StaffDetail')->find($id);
  385. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
  386. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  387. $role = Roles::where('kod',$compound->modul)->first();
  388. $site = SiteSetting::first();
  389. return view('main-dashboard.compound_detail.notice_detail', compact('user','compound','file','role','site'));
  390. }
  391. public function viewCompoundInventoryDetail($kpd){
  392. $id = Auth::guard('sadmin')->id();
  393. $user = Staff::with('StaffDetail')->find($id);
  394. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
  395. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  396. $role = Roles::where('kod',$compound->modul)->first();
  397. $site = SiteSetting::first();
  398. return view('main-dashboard.compound_detail.inventory_detail', compact('user','compound','file','role','site'));
  399. }
  400. public function viewCompoundAuctionDetail($kpd){
  401. $id = Auth::guard('sadmin')->id();
  402. $user = Staff::with('StaffDetail')->find($id);
  403. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
  404. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  405. $role = Roles::where('kod',$compound->modul)->first();
  406. $site = SiteSetting::first();
  407. return view('main-dashboard.compound_detail.auction_detail', compact('user','compound','file','role','site'));
  408. }
  409. public function viewTaskIndex($kpd){
  410. $id = Auth::guard('sadmin')->id();
  411. $user = Staff::with('StaffDetail')->find($id);
  412. $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non', $kpd)->first();
  413. $file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
  414. $staffs = StaffDetail::where('roles_access','PenguatKuasa')->where('department_ids',$compound->jbkod)->get();
  415. $roles = Roles::get();
  416. $role = Roles::where('kod',$compound->modul)->first();
  417. $department = Department::get();
  418. $site = SiteSetting::first();
  419. $currentS = '';
  420. $s = StaffDetail::where('roles_access','PenguatKuasa')->where('_id',$compound->penguatkuasa)->first();
  421. if(!empty($s)){
  422. $currentS = '['.$s->no_badan.'] '.$s->full_name;
  423. }
  424. return view('main-dashboard.compound_detail.compound_job',compact('user','compound','file','roles','staffs','role','department','currentS','site'));
  425. }
  426. public function manualCompound(){
  427. $id = Auth::guard('sadmin')->id();
  428. $user = Staff::with('StaffDetail')->find($id);
  429. $site = SiteSetting::first();
  430. $faulty = Faulty::with('DeedLaw','Department')->get();
  431. $staff = StaffDetail::where('roles_access','PenguatKuasa')->get();
  432. $kawasan = CodeMukim::select('JLN_MKKOD', 'MKM_MNAMA')->groupBy('JLN_MKKOD')->get();
  433. $taman = CodeMukim::select('JLN_KWKOD','KWS_KNAMA')->groupBy('JLN_KWKOD')->get();
  434. $jalan = CodeMukim::all();
  435. return view('main-dashboard.compound.compound_form',compact('user','site','faulty','staff', 'kawasan', 'taman', 'jalan'));
  436. }
  437. /**
  438. * Create generate kpd number controller.
  439. *
  440. * @return value
  441. */
  442. public function generateKPD(){
  443. $count = 0;
  444. do {
  445. $count = Compound::count();
  446. $count = $count + 1;
  447. } while (Compound::where("kpd", "=", 'KP'.$count)->first() instanceof Compound);
  448. return $count;
  449. }
  450. // public function storemanualCompound(Request $request){
  451. // $id = Auth::guard('sadmin')->id();
  452. // $user = Staff::with('StaffDetail')->find($id);
  453. // $compound = Compound::where('kpd', $request->kpd)->first();
  454. // if(empty($compound)){
  455. // $faulty = Faulty::where('_id',$request->get('seksyen'))->first();
  456. // if(!empty($faulty)){
  457. // $kpd = $request->kpd;
  458. // $no_siri = date('yn',strtotime($request->tarikh_dikeluarkan)).'-'.$kpd;
  459. // $fileData = [
  460. // 'no_siri' => $no_siri,
  461. // ];
  462. // if($request->jenisKompaun == 'Parkir'){
  463. // $compoundData = [
  464. // 'jenis' => 'Parkir',
  465. // 'kpd' => $kpd,
  466. // 'nama' => '-',
  467. // 'identity' => '-',
  468. // 'alamat' => '-',
  469. // "no_plate" => strtolower($request->no_plate),
  470. // "no_cukai_jalan" => $request->noCukaijalan,
  471. // "jenis_kenderaan" => $request->jenisKenderaan,
  472. // "model_kenderaan" => $request->modelKenderaan,
  473. // "warna_kenderaan" => $request->warnakenderaan,
  474. // "nama_taman" => $request->namaTaman,
  475. // "nama_jalan" => $request->namaJalan,
  476. // "no_parking" => $request->noParking,
  477. // "catatan" => $request->catatan,
  478. // "lokasi_kejadian" => '-',
  479. // 'latlong' => $request->Latlong,
  480. // 'jbkod' => $request->jabatan,
  481. // 'akta' => $faulty->deed_law_id,
  482. // 'seksyen_kesalahan' => $faulty->_id,
  483. // 'jumlah_asal_kompaun' => $faulty->amount,
  484. // 'jumlah_kemaskini_kompaun' => '',
  485. // 'dikeluarkan' => $request->staff,
  486. // "status" => 'Belum Bayar',
  487. // "amount_payment" => '',
  488. // "receipt" => '',
  489. // "modul" => '03',
  490. // "penguatkuasa" => '',
  491. // "created_at" => new Carbon($request->tarikh_dikeluarkan),
  492. // ];
  493. // }else if($request->jenisKompaun == 'Pelbagai_KT'){
  494. // $compoundData = [
  495. // 'jenis' => 'Pelbagai_KT',
  496. // 'kpd' => $kpd,
  497. // 'nama' => $request->namaP,
  498. // 'identity' => $request->noIc,
  499. // 'nama_syarikat' => $request->namaS,
  500. // 'no_daftar_syarikat' => strtolower($request->daftarNo),
  501. // 'alamat' => $request->alamat,
  502. // 'no_telefon' => $request->tel,
  503. // 'no_akaun_lesen' =>$request->lesen,
  504. // "no_plate" => strtolower($request->no_plate),
  505. // "no_cukai_jalan" => $request->noCukaijalan,
  506. // // "maklumat_tambahan" => $request->catatan,
  507. // "catatan" => $request->catatan,
  508. // "lokasi_kejadian" => $request->lokasi_kejadian,
  509. // 'latlong' => $request->Latlong,
  510. // 'jbkod' => $request->jabatan,
  511. // 'akta' => $faulty->deed_law_id,
  512. // 'seksyen_kesalahan' => $faulty->_id,
  513. // 'jumlah_asal_kompaun' => $faulty->amount,
  514. // 'jumlah_kemaskini_kompaun' => '',
  515. // 'dikeluarkan' => $request->staff,
  516. // "status" => 'Belum Bayar',
  517. // "amount_payment" => '',
  518. // "receipt" => '',
  519. // "modul" => '03',
  520. // "penguatkuasa" => '',
  521. // "created_at" => new Carbon($request->tarikh_dikeluarkan),
  522. // ];
  523. // }else if($request->jenisKompaun == 'Pelbagai_JPB'){
  524. // $compoundData = [
  525. // 'jenis' => 'Pelbagai_JPB',
  526. // 'kpd' => $kpd,
  527. // 'nama' => $request->namaP,
  528. // 'identity' => $request->noIc,
  529. // 'nama_syarikat' => $request->namaS,
  530. // 'no_daftar_syarikat' => strtolower($request->daftarNo),
  531. // 'alamat' => $request->alamat,
  532. // 'no_telefon' => $request->tel,
  533. // 'no_akaun_lesen' =>$request->lesen,
  534. // "no_plate" => strtolower($request->no_plate),
  535. // "no_cukai_jalan" => $request->noCukaijalan,
  536. // // "maklumat_tambahan" => $request->catatan,
  537. // "catatan" => $request->catatan,
  538. // "lokasi_kejadian" => $request->lokasi_kejadian,
  539. // 'latlong' => $request->Latlong,
  540. // 'jbkod' => $request->jabatan,
  541. // 'akta' => $faulty->deed_law_id,
  542. // 'seksyen_kesalahan' => $faulty->_id,
  543. // 'jumlah_asal_kompaun' => $faulty->amount,
  544. // 'jumlah_kemaskini_kompaun' => '',
  545. // 'dikeluarkan' => $request->staff,
  546. // "status" => 'Belum Bayar',
  547. // "amount_payment" => '',
  548. // "receipt" => '',
  549. // "modul" => '03',
  550. // "penguatkuasa" => '',
  551. // "created_at" => new Carbon($request->tarikh_dikeluarkan),
  552. // ];
  553. // }else if($request->jenisKompaun == 'Pelbagai_PA'){
  554. // $compoundData = [
  555. // 'jenis' => 'Pelbagai_PA',
  556. // 'kpd' => $kpd,
  557. // 'nama' => $request->namaP,
  558. // 'identity' => $request->noIc,
  559. // 'nama_syarikat' => $request->namaS,
  560. // 'no_daftar_syarikat' => strtolower($request->daftarNo),
  561. // 'alamat' => $request->alamat,
  562. // 'no_telefon' => $request->tel,
  563. // 'no_akaun_lesen' =>$request->lesen,
  564. // "no_plate" => strtolower($request->no_plate),
  565. // "no_cukai_jalan" => $request->noCukaijalan,
  566. // // "maklumat_tambahan" => $request->catatan,
  567. // "catatan" => $request->catatan,
  568. // "lokasi_kejadian" => $request->lokasi_kejadian,
  569. // 'latlong' => $request->Latlong,
  570. // 'jbkod' => $request->jabatan,
  571. // 'akta' => $faulty->deed_law_id,
  572. // 'seksyen_kesalahan' => $faulty->_id,
  573. // 'jumlah_asal_kompaun' => $faulty->amount,
  574. // 'jumlah_kemaskini_kompaun' => '',
  575. // 'dikeluarkan' => $request->staff,
  576. // "status" => 'Belum Bayar',
  577. // "amount_payment" => '',
  578. // "receipt" => '',
  579. // "modul" => '03',
  580. // "penguatkuasa" => '',
  581. // "created_at" => new Carbon($request->tarikh_dikeluarkan),
  582. // ];
  583. // }else if($request->jenisKompaun == 'Pelbagai_LESEN'){
  584. // $compoundData = [
  585. // 'jenis' => 'Pelbagai_LESEN',
  586. // 'kpd' => $kpd,
  587. // 'nama' => $request->namaP,
  588. // 'identity' => $request->noIc,
  589. // 'nama_syarikat' => $request->namaS,
  590. // 'no_daftar_syarikat' => strtolower($request->daftarNo),
  591. // 'alamat' => $request->alamat,
  592. // 'no_telefon' => $request->tel,
  593. // 'no_akaun_lesen' =>$request->lesen,
  594. // "no_plate" => strtolower($request->no_plate),
  595. // "no_cukai_jalan" => $request->noCukaijalan,
  596. // // "maklumat_tambahan" => $request->catatan,
  597. // "catatan" => $request->catatan,
  598. // "lokasi_kejadian" => $request->lokasi_kejadian,
  599. // 'latlong' => $request->Latlong,
  600. // 'jbkod' => $request->jabatan,
  601. // 'akta' => $faulty->deed_law_id,
  602. // 'seksyen_kesalahan' => $faulty->_id,
  603. // 'jumlah_asal_kompaun' => $faulty->amount,
  604. // 'jumlah_kemaskini_kompaun' => '',
  605. // 'dikeluarkan' => $request->staff,
  606. // "status" => 'Belum Bayar',
  607. // "amount_payment" => '',
  608. // "receipt" => '',
  609. // "modul" => '03',
  610. // "penguatkuasa" => '',
  611. // "created_at" => new Carbon($request->tarikh_dikeluarkan),
  612. // ];
  613. // }
  614. // $file = ConfidentialFile::create($fileData);
  615. // $saved = $file->compound()->create($compoundData);
  616. // if($saved){
  617. // $this->dispatch(new StoreCompoundManual($request->all(), $kpd, $request->staff, $no_siri));
  618. // return redirect()->back()->with('success_msg', 'Berjaya simpan rekod kompaun!');
  619. // }
  620. // }else{
  621. // return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod seksyen kesalahan tidak ditemui!');
  622. // }
  623. // }else{
  624. // return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod kompaun '.$request->kpd.' telah wujud!');
  625. // }
  626. // }
  627. public function storemanualCompound(Request $request){
  628. $id = Auth::guard('sadmin')->id();
  629. $user = Staff::with('StaffDetail')->find($id);
  630. $compound = Compound::where('kpd', $request->kpd)->first();
  631. if(empty($compound)){
  632. $faulty = Faulty::where('_id',$request->get('seksyen'))->first();
  633. $jabatan = Department::where('jnama', $request->jabatan)->first();
  634. if(!empty($faulty) && !empty($jabatan)){
  635. $kpd = $request->kpd;
  636. $no_siri = '';
  637. $compoundData = [];
  638. $created_c = new Carbon($request->tarikh_dikeluarkan);
  639. if($request->jenisKompaun == 'Parkir')
  640. {
  641. //for compound numbering
  642. // $countKPD = $this->compound->where('jenis','Parkir')->withTrashed()->count();
  643. // $kpd = 'KPD'.$countKPD;
  644. $no_siri = date('yn',strtotime($request->tarikh_dikeluarkan)).'-'.$kpd.'-0K';
  645. //only for compound parkir
  646. $compoundData = [
  647. 'jenis' => 'Parkir',
  648. 'kpd' => strtoupper($request->kpd),
  649. 'nama' => '-',
  650. 'identity' => '-',
  651. 'alamat' => '-',
  652. "no_plate" => strtolower($request->no_plate),
  653. "no_cukai_jalan" => $request->noCukaijalan,
  654. "jenis_kenderaan" => $request->jenisKenderaan,
  655. "model_kenderaan" => $request->modelKenderaan,
  656. "warna_kenderaan" => $request->warnakenderaan,
  657. "nama_kawasan" => $request->namaKawasan,
  658. "nama_taman" => $request->namaTaman,
  659. "nama_jalan" => $request->namaJalan,
  660. "no_parking" => $request->noParking,
  661. "catatan" => $request->catatan,
  662. "lokasi_kejadian" => '-',
  663. 'latlong' => $request->Latlong,
  664. 'jbkod' => $jabatan->_id,
  665. 'akta' => $faulty->deed_law_id,
  666. 'seksyen_kesalahan' => $faulty->_id,
  667. 'jumlah_asal_kompaun' => $faulty->amount,
  668. 'jumlah_kemaskini_kompaun' => '-',
  669. 'dikeluarkan' => $user->_id,
  670. "status" => 'Belum Bayar',
  671. "amount_payment" => '-',
  672. "receipt" => '-',
  673. "modul" => '03',
  674. "penguatkuasa" => '-',
  675. "created_c" => $created_c->toDateTimeString(),
  676. "created_at" => new Carbon($request->tarikh_dikeluarkan),
  677. ];
  678. }
  679. elseif ($request->jenisKompaun == 'Pelbagai_KT') {
  680. // $kpd = $this->generateNumber($request->jenis, 'KT', '03');
  681. $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-1K';
  682. $compoundData = [
  683. 'jenis' => $request->jenisKompaun,
  684. 'kpd' => strtoupper($request->kpd),
  685. 'nama' => $request->namaP,
  686. 'identity' => $request->noIc,
  687. 'nama_syarikat' => $request->namaS,
  688. 'no_daftar_syarikat' => strtolower($request->daftarNo),
  689. 'alamat' => $request->alamat,
  690. "lokasi_kejadian" => $request->lokasi_kejadian,
  691. "nama_kawasan" => $request->namaKawasan,
  692. "nama_taman" => $request->namaTaman,
  693. "nama_jalan" => $request->namaJalan,
  694. 'latlong' => $request->Latlong,
  695. 'jbkod' => $jabatan->_id,
  696. 'akta' => $faulty->deed_law_id,
  697. 'seksyen_kesalahan' => $faulty->_id,
  698. 'butiran_kesalahan' => $request->butiran_kesalahan,
  699. 'jumlah_asal_kompaun' => $faulty->amount,
  700. 'jumlah_kemaskini_kompaun' => '-',
  701. 'dikeluarkan' => $user->_id,
  702. "status" => 'Belum Bayar',
  703. "amount_payment" => '-',
  704. "receipt" => '-',
  705. "modul" => '03',
  706. "penguatkuasa" => '-',
  707. "no_akaun_lesen" => $request->lesen,
  708. "created_c" => $created_c->toDateTimeString(),
  709. "created_at" => new Carbon($request->tarikh_dikeluarkan),
  710. ];
  711. }
  712. elseif ($request->jenisKompaun == 'Pelbagai_JPB') {
  713. // $kpd = $this->generateNumber($request->jenis, 'JPB', '03');
  714. $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2K';
  715. $compoundData = [
  716. 'jenis' => $request->jenisKompaun,
  717. 'kpd' => strtoupper($request->kpd),
  718. 'nama' => $request->namaP,
  719. 'identity' => $request->noIc,
  720. 'nama_syarikat' => $request->namaS,
  721. 'no_daftar_syarikat' => strtolower($request->daftarNo),
  722. 'alamat' => $request->alamat,
  723. "lokasi_kejadian" => $request->lokasi_kejadian,
  724. "nama_kawasan" => $request->namaKawasan,
  725. "nama_taman" => $request->namaTaman,
  726. "nama_jalan" => $request->namaJalan,
  727. 'latlong' => $request->Latlong,
  728. 'jbkod' => $jabatan->_id,
  729. 'akta' => $faulty->deed_law_id,
  730. 'seksyen_kesalahan' => $faulty->_id,
  731. 'butiran_kesalahan' => $request->butiran_kesalahan,
  732. 'jumlah_asal_kompaun' => $faulty->amount,
  733. 'jumlah_kemaskini_kompaun' => '-',
  734. 'dikeluarkan' => $user->_id,
  735. "status" => 'Belum Bayar',
  736. "amount_payment" => '-',
  737. "receipt" => '-',
  738. "modul" => '03',
  739. "penguatkuasa" => '-',
  740. "no_akaun_lesen" => $request->lesen,
  741. "created_c" => $created_c->toDateTimeString(),
  742. "created_at" => new Carbon($request->tarikh_dikeluarkan),
  743. ];
  744. }
  745. $fileData = [
  746. 'no_siri' => $no_siri,
  747. ];
  748. $file = ConfidentialFile::create($fileData);
  749. $saved = $file->compound()->create($compoundData);
  750. if($saved){
  751. $this->dispatch(new StoreCompoundManual($request->all(), $kpd, $request->staff, $no_siri));
  752. // $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $user->StaffDetail->full_name, $user->StaffDetail->no_badan, $faulty->nama));
  753. return redirect()->back()->with('success_msg', 'Berjaya simpan rekod kompaun!');
  754. }
  755. }else{
  756. return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod jabatan / seksyen kesalahan tidak ditemui!');
  757. }
  758. }else{
  759. return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod kompaun '.$request->kpd.' telah wujud!');
  760. }
  761. }
  762. public function manualCompoundEdit($_id){
  763. $id = Auth::guard('sadmin')->id();
  764. $user = Staff::with('StaffDetail')->find($id);
  765. $site = SiteSetting::first();
  766. $faulty = Faulty::with('DeedLaw','Department')->get();
  767. $staff = StaffDetail::where('roles_access','PenguatKuasa')->get();
  768. $compound = Compound::with('Faulty','Department','Deedlaw')->find($_id);
  769. return view('main-dashboard.compound.compound_form_edit',compact('user','site','faulty','staff','compound'));
  770. }
  771. public function editmanualCompound(Request $request){
  772. $id = Auth::guard('sadmin')->id();
  773. $user = Staff::with('StaffDetail')->find($id);
  774. $compound = Compound::find($request->_id);
  775. if(!empty($compound)){
  776. $faulty = Faulty::with('DeedLaw','Department')->where('_id',$request->get('seksyen'))->first();
  777. if(!empty($faulty) && !empty($faulty->Deedlaw) && !empty($faulty->Department)){
  778. if($compound->jenis == 'Parkir'){
  779. $compound->kpd = $request->kpd;
  780. $compound->jbkod = $faulty->Department[0]->_id;
  781. $compound->akta = $faulty->DeedLaw->_id;
  782. $compound->seksyen_kesalahan = $faulty->_id;
  783. $compound->no_plate = strtolower($request->no_plate);
  784. $compound->no_cukai_jalan = $request->noCukaijalan;
  785. $compound->jenis_kenderaan = $request->jenisKenderaan;
  786. $compound->model_kenderaan = $request->modelKenderaan;
  787. $compound->warna_kenderaan = $request->warnakenderaan;
  788. $compound->nama_taman = $request->namaTaman;
  789. $compound->nama_jalan = $request->namaJalan;
  790. $compound->no_parking = $request->noParking;
  791. $compound->maklumat_tambahan = $request->catatan;
  792. $compound->catatan = $request->butiran_kesalahan;
  793. $compound->lokasi_kejadian = $request->lokasi_kejadian;
  794. $compound->created_at = new Carbon($request->tarikh_dikeluarkan);
  795. $compound->save();
  796. return redirect()->back()->with('success_msg', 'Berjaya kemasikini!');
  797. }else if($compound->jenis == 'Pelbagai'){
  798. $compound->kpd = $request->kpd;
  799. $compound->jbkod = $faulty->Department[0]->_id;
  800. $compound->akta = $faulty->DeedLaw->_id;
  801. $compound->seksyen_kesalahan = $faulty->_id;
  802. $compound->nama = $request->namaP;
  803. $compound->identity = $request->noIc;
  804. $compound->nama_syarikat = $request->namaS;
  805. $compound->no_daftar_syarikat = strtolower($request->daftarNo);
  806. $compound->alamat = $request->alamat;
  807. $compound->no_telefon = $request->tel;
  808. $compound->no_akaun_lesen = $request->lesen;
  809. $compound->no_plate = strtolower($request->no_plate);
  810. $compound->no_cukai_jalan = $request->noCukaijalan;
  811. $compound->no_plate = strtolower($request->no_plate);
  812. $compound->maklumat_tambahan = $request->catatan;
  813. $compound->catatan = $request->butiran_kesalahan;
  814. $compound->lokasi_kejadian = $request->lokasi_kejadian;
  815. $compound->created_at = new Carbon($request->tarikh_dikeluarkan);
  816. $compound->save();
  817. return redirect()->back()->with('success_msg', 'Berjaya kemasikini!');
  818. }
  819. }else {
  820. return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod seksyen kesalahan tidak ditemui!');
  821. }
  822. }else{
  823. return redirect()->back()->withInput()->with('error_msg', '<strong>Tidak Berjaya!</strong> Rekod kompaun '.$request->kpd.' tidak wujud!');
  824. }
  825. }
  826. }