diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 2c0bd40..54fee9d 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -71,7 +71,10 @@ public function index() return redirect('leDashboard'); }else if($group == "Team Lead" && $dept == "Sales"){ return redirect('salesTL'); + }else if($group == "Sales Engineer" && $dept == "Sales"){ + return redirect('salesEngineer'); } + return view('home',['departments'=>$departments,'users'=>$users,'groups'=>$groups]); } public function viewEmployee($id) @@ -211,69 +214,125 @@ public function viewLeReport($id,Request $request) public function logistics() { $assignment = WardAssignment::where('user_id',Auth::user()->id)->pluck('subward_id')->first(); - $roads = ProjectDetails::where('sub_ward_id',$assignment)->groupBy('road_name')->pluck('road_name'); + $roads = ProjectDetails::where('sub_ward_id',$assignment)->groupBy('road_name')->pluck('road_name'); return view('logisticsroads',['roads'=>$roads]); } public function getRequirementRoads() { $assignment = WardAssignment::where('user_id',Auth::user()->id)->pluck('subward_id')->first(); - $roads = ProjectDetails::where('sub_ward_id',$assignment)->groupBy('road_name')->pluck('road_name'); + $roads = ProjectDetails::where('sub_ward_id',$assignment)->groupBy('road_name')->pluck('road_name'); return view('requirementsroad',['roads'=>$roads]); } public function logisticsRequirement($road) { - $assignment = WardAssignment::where('user_id',Auth::user()->id)->pluck('subward_id')->first(); - $projectlist= ProjectDetails::where('road_name',$road) + $assignment = WardAssignment::where('user_id',Auth::user()->id)->pluck('subward_id')->first(); + $projectlist = ProjectDetails::where('road_name',$road) ->where('sub_ward_id',$assignment) ->get(); return view('logisticslist',['projectlist'=>$projectlist,'pageName'=>"Requirements"]); } public function projectRequirement($road) { - $assignment = WardAssignment::where('user_id',Auth::user()->id)->pluck('subward_id')->first(); - $projectlist= ProjectDetails::where('road_name',$road) + $assignment = WardAssignment::where('user_id',Auth::user()->id)->pluck('subward_id')->first(); + $projectlist = ProjectDetails::where('road_name',$road) ->where('sub_ward_id',$assignment) ->get(); return view('projectlist',['projectlist'=>$projectlist,'pageName'=>"Requirements"]); } - public function subcat(Request $request){ - $data1=$request->only('strUser'); - $data = DB::table('category')->where('category',$data1)->get(); + public function subcat(Request $request) + { + $data1 = $request->only('strUser'); + $data = DB::table('category')->where('category',$data1)->get(); return response()->json($data); } + public function confirmDelivery($id, Request $request) + { + $data1 = $request->only('id'); + $reqid = $data1['id']; + Requirement::where('id',$reqid)->update(['delivery_status' => 'Delivery Confirmed']); + return response()->json($reqid); + } + public function viewlog($id, $recid) + { + $view = Requirement::where('id',$id)->first(); + return view('viewlog',['view' => $view, 'id' => $id, 'recid' => $recid]); + } + public function updateampay($recid, Request $request) + { + $data = $request->only('payment'); + $data = $data['payment']; + Requirement::where('id', $recid)->update(['payment_status' => $data]); + return response()->json($data); + } + public function updateamdispatch($recid, Request $request) + { + $data = $request->only('dispatch'); + $data = $data['dispatch']; + Requirement::where('id', $recid)->update(['dispatch_status' => $data]); + return response()->json($data); + } + public function confirmstatus($id, Request $request) + { + $var2 = $request->only('opt'); + $var = ProjectDetails::where('project_id',$var2['opt'])->update(['status' => "Ready"]); + return response()->json($var); + } + public function confirmthis($id, Request $request) + { + $var = $request->only('opt'); + $var2 = ProjectDetails::where('project_id',$id)->update(['with_cont' => $var['opt']]); + return response()->json($var2); + } //Watch out for this code - // public function amorders(Request $request){ - // $query="SELECT * FROM requirements r, contractor_details c, procurement_details p, owner_details o WHERE r.project_id = c.project_id AND r.project_id = p.project_id AND r.project_id = o.project_id AND r.status = 'Order Confirmed'"; - // $orders = DB::table($query); - // return view('ordersadmin',['orders' => $orders]); - - // // $orders = Requirement::where('status','Order Confirmed')->get(); - // // return view('ordersadmin',['orders' => $orders]); - // } + public function amorders(Request $request) + { + $view = Requirement::where('status','Order Confirmed')->get(); + return view('ordersadmin',['view' => $view]); + } + public function updatestatus($id, Request $request) + { + $view = $request->only('opt'); + $view = $view['opt']; + ProjectDetails::where('project_id', $id)->update(['status' => $view]); + return response()->json($view); + } + public function updatelocation($id, Request $request) + { + $view = $request->only('newtext'); + $view = $view['newtext']; + ProjectDetails::where('project_id', $id)->update(['location' => $view]); + return response()->json($view); + } + public function printLPO($id, Request $request) + { + $datarec = Requirement::where('id', $id)->get(); + return view('printLPO', ['datarec' => $datarec]); + } public function ampricing(Request $request){ - return view('updateprice'); + $data = Requirement::get(); + return view('updateprice',['data' => $data]); } public function viewOrder($id, $rqid, Request $request) { $project = Requirement::where('project_id',$id)->where('id',$rqid)->first(); - return view('ViewOrder',['project' => $project, 'id'=>$id]); + return view('ViewOrder',['project' => $project, 'id' => $id]); } public function viewrec($id, $rqid, Request $request) { $project = ProjectDetails::where('project_id',$id)->first(); $req = Requirement::where('project_id',$id)->where('id',$rqid)->first(); - return view('ViewRecord',['project'=>$project, 'req'=>$req,'id'=>$id]); + return view('ViewRecord',['project'=>$project, 'req' => $req, 'id' => $id]); } public function logisticdetails($id) { $requirements = Requirement::where('project_id',$id)->where('status','Order Confirmed')->get(); - return view('Logistics',['requirements'=>$requirements,'id'=>$id]); + return view('Logistics',['requirements'=>$requirements, 'id'=>$id]); } public function getRequirements($id) { $requirements = Requirement::where('project_id',$id)->get(); $category = DB::table('category')->groupBy("category")->get(); - return view('requirements',['requirements'=>$requirements,'id'=>$id,'category' => $category]); + return view('requirements',['requirements'=>$requirements, 'id'=>$id, 'category' => $category]); } public function deleteReportImage($id) { @@ -368,7 +427,9 @@ public function getSalesEngineer() { $assignment = WardAssignment::where('user_id',Auth::user()->id)->pluck('subward_id')->first(); $projects = ProjectDetails::where('sub_ward_id',$assignment)->paginate(10); - return view('salesengineer',['projects'=>$projects]); + $subwards = SubWard::where('id',$assignment)->first(); + $projects1 = ProjectDetails::where('sub_ward_id',$assignment)->get(); + return view('salesengineer',['projects'=>$projects, 'subwards' => $subwards, 'projects1' => $projects1]); } public function getSalesTL(){ $id = Department::where('dept_name',"Sales")->pluck('id')->first(); diff --git a/app/Http/Controllers/mamaController.php b/app/Http/Controllers/mamaController.php index 67134d3..6fa5e49 100644 --- a/app/Http/Controllers/mamaController.php +++ b/app/Http/Controllers/mamaController.php @@ -24,6 +24,7 @@ use App\Requirement; use Auth; use Validator; +use DB; class mamaController extends Controller { @@ -557,17 +558,11 @@ public function addRequirement(Request $request,$id) // } - public function orderConfirm($id, Request $request) - { - $counting = count($request->requirement); - if($counting == 0){ - return back()->with('Error','Please select orders to be confirmed'); - }else{ - $project = projectdetails::where('project_id',$id)->first(); - Requirement::where('project_id',$id)->where('status','Order Placed')->update(['status' => "Order Confirmed"]); - $orders = Requirement::where('project_id',$id)->where('status','Order Confirmed')->get(); - return redirect($id.'/requirements')->with('Confirmed','Order has been confirmed'); - } + public function orderConfirm(Request $request) + { + $val = $request->only('select'); + Requirement::where('id', $val)->update(['status' => 'Order Confirmed']); + return response()->json($val); } //This function by Sid public function editOrder($id, $rqid, Request $request){ diff --git a/resources/views/Logistics.blade.php b/resources/views/Logistics.blade.php index 38e619e..c98ec7f 100644 --- a/resources/views/Logistics.blade.php +++ b/resources/views/Logistics.blade.php @@ -2,7 +2,7 @@ @section('content') -
Order No. | -Main Category | -Sub-Category | -Qnty. | -Status | +Order No. | +Main Category | +Sub-Category | +Qnty. | +Status | Payment Status | Delivery Status | +Dispatch Status | Action | - + Confirm Order --> @@ -100,6 +118,23 @@ @endsection \ No newline at end of file diff --git a/resources/views/printLPO.blade.php b/resources/views/printLPO.blade.php new file mode 100644 index 0000000..e398d0d --- /dev/null +++ b/resources/views/printLPO.blade.php @@ -0,0 +1,19 @@ +@extends('layouts.app') + +@section('content') +: | @@ -91,7 +91,7 @@ | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Total Amount | : | -+ | |||||||||||||||||||||||||||||||||||||||||||||||||
Notes | @@ -149,7 +149,7 @@{{ $requirement->status }} | @if($requirement->status !== 'Order Cancelled' && $requirement->status !== 'Order Confirmed') - + @endif | @@ -158,7 +158,7 @@ " id="btnprint{{$requirement->id}}">Edit @endif | -+ |
@if($requirement->status == 'Order Confirmed')
View
@endif
@@ -220,12 +220,25 @@ function getPrice(){
function printChecked(){
var items=document.getElementsByName('requirement[]');
- var selectedItems="";
+ var selectedItems='';
+ //console.log(items.length);
for(var i=0; i
-
-
-
- Project List
+
+
+ Project List
-
-
-
- Enquiry
-
-
-
-
-
+
- Add Details --- |