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') -
+
Enquiry @@ -27,14 +27,15 @@ - - - - - + + + + + + - + 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') +
+
+ +

+ +

PURCHASE ORDER



+
+

Mama Home Pvt Ltd

+

#363, 19th Main Road 1st Block,
Rajajinagar, Bangalore-560010
Ph: 9110636146
Email: info@mamahome360.com +

+
+ +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/requirements.blade.php b/resources/views/requirements.blade.php index bfd0e12..078fd74 100644 --- a/resources/views/requirements.blade.php +++ b/resources/views/requirements.blade.php @@ -33,7 +33,7 @@ @@ -91,7 +91,7 @@ - + @@ -149,7 +149,7 @@ -
Order No.Main CategorySub-CategoryQnty.Status Order No. Main Category Sub-Category Qnty. Status Payment Status Delivery Status Dispatch Status Action :
Total Amount :
Notes{{ $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; iid }}/viewOrder\" class=\"btn btn-sm btn-success text-center\" style=\"margin-top: 8%\" id=\"status-{{$requirement->id}}\">View"; + } + }); + } } - $.ajax({}); } function checkdate(){ diff --git a/resources/views/salesengineer.blade.php b/resources/views/salesengineer.blade.php index a7f60b5..d4b0237 100644 --- a/resources/views/salesengineer.blade.php +++ b/resources/views/salesengineer.blade.php @@ -1,30 +1,84 @@ @extends('layouts.app') @section('content') - -
-
-
-
-
Project List
+
+
+
Project List
- +
- + + + + + + + @foreach($projects as $project) + - - + + + + + + + @endforeach @@ -35,7 +89,147 @@ - - + @endsection \ No newline at end of file diff --git a/resources/views/salesprojects.blade.php b/resources/views/salesprojects.blade.php new file mode 100644 index 0000000..3f855c1 --- /dev/null +++ b/resources/views/salesprojects.blade.php @@ -0,0 +1,114 @@ +@extends('layouts.app') +@section('content') +
+
+
Project List
+ +
+
Project NameAddressSubwardAddress Procurement Name Contact No. Status ActionStatus Location Materials Requirement DateWith/Without Contractor
{{ $project->project_name }}{{ $subwards->sub_ward_name }} {{ $project->siteaddress->address }} {{ $project->procurementdetails->procurement_name }}
{{ $project->procurementdetails->procurement_contact_no }}
Not Confirmed{{$project->status}} + @if($project->project_status == 'null') + + @else + + @endif + + + + + + + + + + +
+ + + + + + + + + + + + + + @foreach($projects as $project) + + + + + + + + + + @if($project->with_cont == 'null') + + @endif + @if($project->with_cont == 'With Contractor') + + @endif + @if($project->with_cont == 'Without Contractor') + + @endif + + @endforeach + +
Project NameSubwardAddressProcurement NameContact No.StatusActionEmail idWith/Without Contractor
{{ $project->project_name }}{{$project->project_id}}{{ $subwards->sub_ward_name }}{{ $project->siteaddress->address }}{{ $project->procurementdetails->procurement_name }}
{{ $project->procurementdetails->procurement_contact_no }}
+ {{$project->status}} + + + + + + + + +
+
+ +
+
+ + +@endsection \ No newline at end of file diff --git a/resources/views/updateprice.blade.php b/resources/views/updateprice.blade.php index 1ac99f2..62d38ae 100644 --- a/resources/views/updateprice.blade.php +++ b/resources/views/updateprice.blade.php @@ -1,68 +1,101 @@ @extends('layouts.app') @section('content') -
-
-
- Enquiry - -
-
-
-

- Add Details -

-
-
-
- - - - - - - - - - - - - -
- - - -
- - - -
- - - -
-
- - - - - -
- - - -
+
+
+
+
+ Enquiry + +
+
+
+

+ Add Details +

+
+ +
+ + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+
+ + + + + +
+ + + +
+
+
+ +
-
- - -
- -
+
+ + + + + + + + + + @foreach($data as $row) + + + + + + @endforeach + +
+ Category + + Sub-Category + + Price +
+ {{$row->main_category}} + + {{$row->sub_category}} + + {{$row->unit_price}} +
+ +
+