Skip to content

Commit

Permalink
Modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
iamwebwiz committed Nov 28, 2017
1 parent 8d2ea31 commit 52a92dd
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/node_modules
/public/hot
/public/storage
/public/images/trackings
/storage/*.key
/vendor
/.idea
Expand Down
10 changes: 10 additions & 0 deletions app/Http/Controllers/TrackingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public function addNewTracking(Request $request)
$tracking->payment_mode = $request->payment_mode;
$tracking->departure_time = $request->departure_time;
$tracking->package = $request->package;
if (!is_null($request->image)) {
$filepath = $request->carrier.time().'.'.$request->image->getClientOriginalExtension();
$image = $request->image->move(public_path('images/trackings'), $filepath);
$tracking->image = $filepath;
}
$tracking->carrier = $request->carrier;
$tracking->weight = $request->weight;
$tracking->product = $request->product;
Expand Down Expand Up @@ -76,6 +81,11 @@ public function editTracking(Request $request, $id)
$this->data['tracking']->payment_mode = $request->payment_mode;
$this->data['tracking']->departure_time = $request->departure_time;
$this->data['tracking']->package = $request->package;
if (!is_null($request->image)) {
$filepath = $request->carrier.time().'.'.$request->image->getClientOriginalExtension();
$image = $request->image->move(public_path('images/trackings'), $filepath);
$this->data['tracking']->image = $filepath;
}
$this->data['tracking']->carrier = $request->carrier;
$this->data['tracking']->weight = $request->weight;
$this->data['tracking']->product = $request->product;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function up()
$table->string('payment_mode')->nullable();
$table->string('departure_time')->nullable();
$table->string('package')->nullable();
$table->string('image')->nullable();
$table->string('carrier')->nullable();
$table->string('weight')->nullable();
$table->string('product')->nullable();
Expand Down
13 changes: 12 additions & 1 deletion resources/views/tracking/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<div class="row">
<div class="col-md-10 col-md-offset-1">
@include('partials.alerts')
<form action="{{ route('editTracking', ['id'=>$tracking->trackingID]) }}" method="post" class="form-horizontal">
<form action="{{ route('editTracking', ['id'=>$tracking->trackingID]) }}" method="post" class="form-horizontal"
enctype="multipart/form-data">
{{ csrf_field() }}
{{ method_field('PUT') }}
<div class="form-group">
Expand Down Expand Up @@ -78,6 +79,16 @@
</div>
</div>

<div class="form-group">
<label for="image" class="control-label col-sm-4">Image</label>
<div class="col-sm-8">
<label class="btn btn-info">
<span class="glyphicon glyphicon-camera"></span> Choose Image
<input type="file" name="image" accept="image/*" style="display:none" class="form-control">
</label>
</div>
</div>

<div class="form-group">
<label for="carrier" class="control-label col-sm-4">Carrier</label>
<div class="col-sm-8">
Expand Down
13 changes: 12 additions & 1 deletion resources/views/tracking/new.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<div class="row">
<div class="col-md-10 col-md-offset-1">
@include('partials.alerts')
<form action="{{ route('addNewTracking') }}" method="post" class="form-horizontal">
<form action="{{ route('addNewTracking') }}" method="post" class="form-horizontal"
enctype="multipart/form-data">
{{ csrf_field() }}
<div class="form-group">
<label for="origin" class="control-label col-sm-4">Origin</label>
Expand Down Expand Up @@ -77,6 +78,16 @@
</div>
</div>

<div class="form-group">
<label for="image" class="control-label col-sm-4">Image</label>
<div class="col-sm-8">
<label class="btn btn-info">
<span class="glyphicon glyphicon-camera"></span> Choose Image
<input type="file" name="image" accept="image/*" style="display:none" class="form-control">
</label>
</div>
</div>

<div class="form-group">
<label for="carrier" class="control-label col-sm-4">Carrier</label>
<div class="col-sm-8">
Expand Down
5 changes: 5 additions & 0 deletions resources/views/trackingresult.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
<h3>TRACKING NO: {{ $tracking->trackingID }}</h3>
<br>
<img src="{{ asset('images/barcode.png') }}" alt="Barcode">
<br><br>
<a href="{{ asset('images/trackings/'.$tracking->image) }}" target="_blank">
<img src="{{ asset('images/trackings/'.$tracking->image) }}" width="250" alt="Tracking Image"
class="img-thumbnail">
</a>
</div>
<div class="col-md-8 col-sm-8">
@if (is_null($tracking->geolocation))
Expand Down

0 comments on commit 52a92dd

Please sign in to comment.