Skip to content

Commit

Permalink
initial shipment history form fields added
Browse files Browse the repository at this point in the history
  • Loading branch information
iamwebwiz committed Dec 13, 2017
1 parent 52a92dd commit c36abd1
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 17 deletions.
12 changes: 12 additions & 0 deletions app/ShipmentHistory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class ShipmentHistory extends Model
{
public function tracking() {
return $this->belongsTo(Tracking::class);
}
}
4 changes: 3 additions & 1 deletion app/Tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@

class Tracking extends Model
{
//
public function shipmentHistories() {
return $this->hasMany(ShipmentHistory::class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShipmentHistoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('shipment_histories', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('tracking_id');
$table->string('location');
$table->timestamp('date');
$table->timestamp('time');
$table->string('status');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('shipment_histories');
}
}
37 changes: 37 additions & 0 deletions resources/views/tracking/new.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,43 @@
</div>
</div>

<hr>

<h3 class="text-center">Shipment History</h3>

<div class="form-group">
<label class="control-label col-sm-4">Location</label>
<div class="col-sm-8">
<input type="text" name="shipping_location" placeholder="Shipment Location"
class="form-control" value="{{ old('shipping_location') }}">
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-4">Date</label>
<div class="col-sm-8">
<input type="date" name="shipping_date" placeholder="Shipment Date"
class="form-control" value="{{ old('shipping_date') }}">
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-4">Time</label>
<div class="col-sm-8">
<input type="time" name="shipping_time" placeholder="Shipment Time"
class="form-control" value="{{ old('shipping_time') }}">
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-4">Status</label>
<div class="col-sm-8">
<textarea name="shipping_status" rows="5" class="form-control" placeholder="Shipment Status">
{{ old('shipping_status') }}
</textarea>
</div>
</div>

<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<button class="btn btn-primary" type="submit">
Expand Down
32 changes: 16 additions & 16 deletions resources/views/trackingresult.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,67 +156,67 @@ function initMap() {
<div class="panel-body">
<div class="row">
<div class="col-md-4 col-sm-4">
<h4>Origin:</h4> {{ $tracking->origin }}
<h4>Origin:</h4> {!! $tracking->origin !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Package:</h4> {{ $tracking->package }}
<h4>Package:</h4> {!! $tracking->package !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Status:</h4> {{ $tracking->shipment_status }}
<h4>Status:</h4> {!! $tracking->shipment_status !!}
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4 col-sm-4">
<h4>Destination:</h4> {{ $tracking->destination }}
<h4>Destination:</h4> {!! $tracking->destination !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Carrier:</h4> {{ $tracking->carrier }}
<h4>Carrier:</h4> {!! $tracking->carrier !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Departure Time:</h4> {{ $tracking->departure_time }}
<h4>Departure Time:</h4> {!! $tracking->departure_time !!}
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4 col-sm-4">
<h4>Type of Shipment:</h4> {{ $tracking->shipment_type }}
<h4>Type of Shipment:</h4> {!! $tracking->shipment_type !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Weight:</h4> {{ $tracking->weight.'kg' }}
<h4>Weight:</h4> {!! $tracking->weight.'kg' !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Shipment Mode:</h4> {{ $tracking->shipment_mode }}
<h4>Shipment Mode:</h4> {!! $tracking->shipment_mode !!}
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4 col-sm-4">
<h4>Carrier Reference No.</h4> {{ $tracking->trackingID }}
<h4>Carrier Reference No.</h4> {!! $tracking->trackingID !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Product:</h4> {{ $tracking->product }}
<h4>Product:</h4> {!! $tracking->product !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Quantity:</h4> {{ $tracking->quantity }}
<h4>Quantity:</h4> {!! $tracking->quantity !!}
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4 col-sm-4">
<h4>Pick-up Time:</h4> {{ $tracking->pickup_time }}
<h4>Pick-up Time:</h4> {!! $tracking->pickup_time !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Pick-up Date:</h4> {{ $tracking->pickup_date }}
<h4>Pick-up Date:</h4> {!! $tracking->pickup_date !!}
</div>
<div class="col-md-4 col-sm-4">
<h4>Expected Delivery Date:</h4> {{ $tracking->expected_delivery_date }}
<h4>Expected Delivery Date:</h4> {!! $tracking->expected_delivery_date !!}
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4 col-sm-4">
<h4>Payment Mode:</h4> {{ $tracking->payment_mode }}
<h4>Payment Mode:</h4> {!! $tracking->payment_mode !!}
</div>
</div>
</div>
Expand Down

0 comments on commit c36abd1

Please sign in to comment.