Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sid branch #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 84 additions & 23 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();
Expand Down
17 changes: 6 additions & 11 deletions app/Http/Controllers/mamaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use App\Requirement;
use Auth;
use Validator;
use DB;

class mamaController extends Controller
{
Expand Down Expand Up @@ -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){
Expand Down
61 changes: 48 additions & 13 deletions resources/views/Logistics.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@section('content')

<div class="col-md-10 col-md-offset-1">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<strong style="color:white">Enquiry</strong>
Expand All @@ -27,14 +27,15 @@
<!--These lines by Siddharth copy the ids attribute here-->
<table class="table table-responsive table-striped">
<thead>
<th style="text-align:center" id="rqno">Order No.</th>
<th style="text-align:center">Main Category</th>
<th style="text-align:center">Sub-Category</th>
<th style="text-align:center">Qnty.</th>
<th style="text-align:center" id="statusth">Status</th>
<th style="text-align:center" id="rqno"> Order No.</th>
<th style="text-align:center"> Main Category</th>
<th style="text-align:center"> Sub-Category</th>
<th style="text-align:center"> Qnty.</th>
<th style="text-align:center" id="statusth"> Status</th>
<th style="text-align:center" id='noid'></th>
<th style="text-align:center"> Payment Status</th>
<th style="text-align:center"> Delivery Status</th>
<th style="text-align:center"> Dispatch Status</th>
<th style="text-align:center" colspan=2>Action</th>
<!-- <th></th>
<th style="text-align:center" id='updateth'>Action</th>
Expand All @@ -43,7 +44,6 @@
</thead>
<tbody>
@foreach($requirements as $requirement)

<tr id="tr{{ $requirement->id }}" valign="center" align="center">
<td style="text-align:center" id='rq{{$requirement->id}}'>{{ $requirement->id }}</td>
<td style="text-align:center">{{ $requirement->main_category }}</td>
Expand All @@ -55,10 +55,29 @@
<input type="checkbox" style="margin-top:50%" name="requirement[]" id="requirement[]" value="{{ $requirement->id }}">
@endif
</td>
<td>Payment Received</td>
<td>Delivered</td>
<td><a name="" href="{{ URL::to('/') }}/{{$id}}/{{$requirement->id}}/deliver" class="btn btn-sm btn-primary">Deliver</a></td>
<td><a name="" href="{{ URL::to('/') }}/{{$id}}/{{$requirement->id}}/viewrec" id="view-{{$requirement->id}}" class="btn btn-sm btn-info">View</a></td>

@if($requirement->payment_status !== 'null')
<td>
{{$requirement->payment_status}}
</td>
@else
<td>
Payment Pending
</td>
@endif
<td id='delstatus{{$requirement->id}}'>
{{$requirement->delivery_status}}
</td>
<td></td>
<td id="delivery{{$requirement->id}}">
@if($requirement->delivery_status !== 'Delivery Confirmed')
<a name="deliver-{{ $requirement->id }}" id="deliver-{{ $requirement->id }}" onclick="deliver('{{ $requirement->id }}')" class="btn btn-sm btn-primary">Deliver</a>
@endif
</td>

<td>
<a name="view-{{ $requirement->id }}" id="view-{{$requirement->id}}" href="{{URL::to('/')}}/{{$id}}/{{$requirement->id}}/viewlog" class="btn btn-sm btn-warning">View</a>
</td>
<!-- <td>
@if($requirement->status !== 'Order Cancelled')
<a style="margin-top:8%;" href="{{ URL::to('/') }}/{{ $id }}/{{$requirement->id}}/editOrder" class="btn btn-sm btn-info text-center
Expand All @@ -83,8 +102,7 @@
</tbody>
</table>
<!-- <input type="submit" class="btn btn-success" name="Submit" id="submitform" value="Place Order">
<a href="{{ URL::to('/') }}/{{$id}}/orderConfirm" name="confirmOrder" class="btn btn-md btn-primary" id="confirmOrder" value="Confirm Order">Confirm Order</a> -->

<a href="{{ URL::to('/') }}/{{$id}}/orderConfirm" name="confirmOrder" class="btn btn-md btn-primary" id="confirmOrder" value="Confirm Order">Confirm Order</a> -->
</form>
</div>
</div>
Expand All @@ -100,6 +118,23 @@
</div>
<!--This section by Siddharth -->
<script type="text/javascript">
function deliver(arg){
var x = confirm('Are You Sure ? Changes Once Made CANNOT Be Undone');
if(x){
$.ajax({
type: 'GET',
url: '{{ URL::to('/') }}/'+arg+'/confirmdelivery',
data: {id: arg},
async: false,
success: function(response){
document.getElementById('delstatus'+response).innerHTML = 'Delivery Confirmed';
document.getElementById('delivery'+response).innerHTML = '';
}
});
}
location.reload();
return false;
}
function checkdate(){
var today = new Date();
var day = (today.getDate().length ==1?"0"+today.getDate():today.getDate()); //This line by Siddharth
Expand Down
Loading