Merge branch 'asif/warehouses' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into asif/contact

# Conflicts:
#	app/Http/Controllers/ContactController.php
#	routes/api.php
This commit is contained in:
Aqeeb Imtiaz Harun
2018-06-27 09:51:56 +08:00
37 changed files with 1104 additions and 5572 deletions
+1
View File
@@ -12,3 +12,4 @@ Homestead.yaml
npm-debug.log
yarn-error.log
.env
.lock
-16
View File
@@ -1,16 +0,0 @@
FROM php:7
WORKDIR /app
COPY . /app
RUN apt-get update -y && apt-get install -y openssl zip unzip git netcat libpng-dev
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install gd
WORKDIR /app
COPY . /app
RUN composer update
ADD start.sh /start.sh
CMD ["/start.sh"]
+20 -9
View File
@@ -6,18 +6,29 @@ use Illuminate\Database\Eloquent\Model;
class Company extends Model
{
//
protected $fillable = ['user_id', 'company_profile', 'reg_cert', 'company_name', 'registration_no', 'tax_no', 'tel_no', 'fax', 'address', 'city', 'postcode', 'state', 'country', 'contact_person'];
//protected $guarded = [];
protected $fillable = ['user_id', 'company_profile', 'reg_cert', 'company_name', 'registration_no', 'tax_no', 'tel_no', 'fax', 'address', 'city', 'postcode', 'state', 'country', 'contact_person'];
public function Contact()
{
return $this->hasMany(Contact::class);
}
public function user()
{
return $this->belongsTo('App\User');
}
public function deliveryinfo() {
return $this->hasMany('App\Deliveryinfo');
}
public function warehouse() {
return $this->hasMany('App\Warehouse');
}
public function contact() {
return $this->hasMany('App\Contact');
}
}
+6 -13
View File
@@ -8,23 +8,16 @@ class Contact extends Model
{
protected $fillable = ['company_id'];
public function user() {
public function User()
{
return $this->belongsTo(User::class);
}
public function Company()
{
return $this->belongsTo(Company::class);
return $this->belongsTo(App/User);
}
public function company(){
return $this->belongsTo(App/Company);
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Deliveryinfo extends Model
{
protected $fillable = [
'id',
'branch',
'deli_info',
'address',
'city',
'postcode',
'state',
'country',
'contact_person',
'contact_person_no',
'com_id'
];
public function company() {
return $this->belongsTo('App\Company');
}
}
+9 -7
View File
@@ -17,13 +17,12 @@ class CompanyController extends Controller
}
$output= array();
$matchedTerms = Company::where('company_name', 'LIKE','%'. $request->search . '%')->get();
//return response()->json($matchedTerm);
if($matchedTerms)
{
foreach ($matchedTerms as $key => $matchedTerm)
{
array_push($output, ['company_name' => $matchedTerm->company_name, 'tel_no' => $matchedTerm->tel_no,
array_push($output, ['com_id'=> $matchedTerm->id, 'company_name' => $matchedTerm->company_name, 'tel_no' => $matchedTerm->tel_no,
'contact_person'=>$matchedTerm->contact_person ]);
}
@@ -53,14 +52,17 @@ class CompanyController extends Controller
'state' => 'required',
'country' => 'required',
'contact_person' => 'required'
];
];
$validator = Validator::make($request->all(), $rules);
if($validator->fails()) {
return response()->json(['success'=> false, 'error'=> 'All the fields are required'], 400);
//return response()->json(['success'=> false, 'error'=> $validator->messages()], 400);
$validator = Validator::make($request->all(), $rules);
if($validator->fails()) {
return response()->json(['success'=> false, 'error'=> 'All the fields are required'], 400);
//return response()->json(['success'=> false, 'error'=> $validator->messages()], 400);
}
}
public function create()
{
$company->company_name=$request->input('company_name');
$company->registration_no=$request->input('registration_no');
$company->tax_no=$request->input('tax_no');
+35 -30
View File
@@ -5,51 +5,46 @@ namespace App\Http\Controllers;
use App\Contact;
use App\Company;
use Illuminate\Http\Request;
use Auth;
class ContactController extends Controller
{
public function index()
{
$contact=Contact::all();
$response=[
'contact'=>$contact
];
return response()->json($contact, 200);
$contacts = Contact::where('user_id', Auth::user()->id)->where('id', $id)->get();
if (!$contacts)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
return response()->json($contacts, 200);
}
public function sendRequest(Request $request)
{
// get company id from request ex:
//$request->input('company_id');
$company_id = $request->input('company_id');
$user = Auth::user();
$com_id = $request->input('com_id');
// query to find company asisng to $company
$company = Company::find($company_id);
$company = Company::find($com_id);
// get user from session
//$request->user();
$request->user();
$user = $request->user();
// prepare query
$contact = new Contact();
$contact->company_id = $company->id;
$contact->user_id = $user->id;
$contact->save();
// insert into database
$contact = new Contact();
$contact->com_id = $company->id;
$contact->user_id = $user->id;
$contact->save();
return response()->json($contact, 201);
}
public function destroy($id)
{
$contact = Contact::where("user_id", Auth::user()->id)->where('id', $id)->first();
//$contact=Contact::find($id);
$contact->delete();
return response()->json($contact, 204);
}
public function acceptRequest(Request $request, $id)
{
$contact = Contact::where("user_id", Auth::user()->id)->where('id', $id)->first();
$contact = Contact::where('com_id', Auth::user()->company())->where('id', $id)->first();
//$contact = Contact::where('id', '=', e($id))->first();
if($contact)
{
@@ -63,6 +58,7 @@ class ContactController extends Controller
$contact->status=0;
}
else{
return response()->json(["message" => "not allowed"], 400);
}
@@ -71,11 +67,20 @@ class ContactController extends Controller
return response()->json($contact, 201);
}
return response()->json($contact, 400);
// $contact = $request->input('id');
// $contact->status = 1;
// $contact->save();
//return redirect()->back()->with('info','Request has been approved ');
}
}
public function destroy($id)
{
$contact = Contact::where('com_id', Auth::user()->company())->where('id', $id)->first();
if (!$contact)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
$contact->delete($id);
return response()->json($contact, 204);
}
}
@@ -0,0 +1,125 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Deliveryinfo;
use App\User;
use App\Company;
use Auth;
class DeliveryinfoController extends Controller
{
public function index()
{
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->get();
if (!$deliveryinfo)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
return response()->json($deliveryinfo, 200);
}
/**
* Display the specified delivery-info.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(Deliveryinfo $id)
{
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->first();
if (!$deliveryinfo)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
$deliveryinfos = DB::table('deliveryinfos')
->select('id', 'branch', 'deli_info', 'address', 'city', 'postcode', 'state', 'country', 'contact_person', 'contact_person_no', 'com_id')
->where('com_id', Auth::user()->company())
->get();
return response()->json($deliveryinfo, 200);
}
/**
* Store a newly delivery-info in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$user = Auth::user();
$deliveryinfo = new Deliveryinfo;
$deliveryinfo->branch = $request->input('branch');
$deliveryinfo->deli_info = $request->input('deli_info');
$deliveryinfo->address = $request->input('address');
$deliveryinfo->city = $request->input('city');
$deliveryinfo->postcode = $request->input('postcode');
$deliveryinfo->state = $request->input('state');
$deliveryinfo->country = $request->input('country');
$deliveryinfo->contact_person = $request->input('contact_person');
$deliveryinfo->contact_person_no = $request->input('contact_person_no');
$deliveryinfo->com_id = $user->company();
$deliveryinfo->save();
return response()->json(['deliveryinfo'=>$deliveryinfo],201);
}
/**
* Update the delivery-info.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
if (!$deliveryinfo)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
$deliveryinfo->branch = $request->input('branch');
$deliveryinfo->deli_info = $request->input('deli_info');
$deliveryinfo->address = $request->input('address');
$deliveryinfo->city = $request->input('city');
$deliveryinfo->postcode = $request->input('postcode');
$deliveryinfo->state = $request->input('state');
$deliveryinfo->country = $request->input('country');
$deliveryinfo->contact_person = $request->input('contact_person');
$deliveryinfo->contact_person_no = $request->input('contact_person_no');
$deliveryinfo->com_id = $user->company();
$deliveryinfo->save();
return response()->json(['deliveryinfo'=>$deliveryinfo],200);
}
/**
* Remove the delivery-info.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Deliveryinfo $id)
{
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
if (!$deliveryinfo)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
$deliveryinfo->delete($id);
return response()->json($deliveryinfo, 204);
}
}
+69 -61
View File
@@ -9,77 +9,77 @@ use Illuminate\Http\Request;
class WarehouseController extends Controller
{
/**
* Display a listing of the resource.
* list all the warehouse from user's contact's where user is freight forwarder
*
* @param int $id
* @return \Illuminate\Http\Response
*/
*/
public function index()
{
$warehouses = Warehouse::where('com_id', Auth::user()->company())->get();
if (!$warehouses)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
$warehouse=Warehouse::all();
$response=[
//$warehouse = Warehouse::all();
'warehouse'=>$warehouse
];
return response()->json($warehouse, 200);
return response()->json($warehouses, 200);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$warehouse = Warehouse::create($request->all());
return response()->json($warehouse, 201);
}
/**
* Display the specified resource.
/**
* Display warehouse list from freight forwarder. can list the warehouse if it is from the freight forwarder
* need to do DB query
* show all the warehouse that belongs to the user company
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$warehouse=Warehouse::find($id);
$response=[
$warehouses = DB::table('warehouses')
->select('id', 'address', 'city', 'zip', 'state', 'contact_person', 'contact_person_no', 'branch', 'country', 'com_id')
->where('com_id', Auth::user()->company())
->get();
'warehouse'=>$warehouse
if (!$warehouses)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
];
return response()->json($warehouse, 200);
}
/**
* Show the form for editing the specified resource.
* Store a new warehouse.
*
* @param int $id
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function edit($id)
public function store(Request $request)
{
//
}
$user = Auth::user();
$warehouse = new Warehouse;
$warehouse->address = $request->input('address');
$warehouse->city = $request->input('city');
$warehouse->zip = $request->input('zip');
$warehouse->state = $request->input('state');
$warehouse->contact_person = $request->input('contact_person');
$warehouse->contact_person_no = $request->input('contact_person_no');
$warehouse->branch = $request->input('branch');
$warehouse->country = $request->input('country');
$warehouse->com_id = $user->company();
$warehouse->save();
return response()->json($warehouse, 201);
}
/**
* Update the specified resource in storage.
* Update warehouse.
*
* @param \Illuminate\Http\Request $request
* @param int $id
@@ -88,37 +88,45 @@ class WarehouseController extends Controller
public function update(Request $request, $id)
{
$warehouse = Warehouse::find($id);
$warehouse = Warehouse::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
if (!$warehouse)
{
return response()->json(['message'=>'Document not found'],200);
return response()->json(['message'=>'Access Denied!'], 404);
}
$warehouse->address=$request->input('address');
$warehouse->city=$request->input('city');
$warehouse->zip=$request->input('zip');
$warehouse->state=$request->input('state');
$warehouse->contact_person=$request->input('contact_person');
$warehouse->contact_person_no=$request->input('contact_person_no');
$warehouse->branch=$request->input('branch');
$warehouse->country=$request->input('country');
$warehouse->company_id=$request->input('company_id');
$warehouse->address = $request->input('address');
$warehouse->city = $request->input('city');
$warehouse->zip = $request->input('zip');
$warehouse->state = $request->input('state');
$warehouse->contact_person = $request->input('contact_person');
$warehouse->contact_person_no = $request->input('contact_person_no');
$warehouse->branch = $request->input('branch');
$warehouse->country = $request->input('country');
$warehouse->com_id = $user->company();
$warehouse->save();
return response()->json(['warehouse'=>$warehouse],200);
}
/**
* Remove the specified resource from storage.
* Remove the warehouse.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
public function destroy(Warehouse $id)
{
//
$warehouse = Warehouse::where('com_id', Auth::user()->company())->where('id', $id)->firstOrFail();
if (!$warehouse)
{
return response()->json(['message'=>'Access Denied!'], 404);
}
$warehouse->delete($id);
return response()->json($warehouse, 204);
}
}
+7 -1
View File
@@ -6,5 +6,11 @@ use Illuminate\Database\Eloquent\Model;
class Warehouse extends Model
{
protected $fillable = ['city', 'address','zip','state','contact_person','contact_person_no','branch','country','company_id'];
protected $fillable = ['city', 'address','zip','state','contact_person','contact_person_no','branch','country','com_id'];
public function contact(){
return $this->hasMany(App/Contact);
}
}
Generated
-5135
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -53,6 +53,21 @@ return [
'strict' => true,
'engine' => null,
],
'testing' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'testingizyim',
'username' => 'root',
'password' => '',
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
+3
View File
@@ -15,6 +15,9 @@ use Faker\Generator as Faker;
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => bcrypt(str_random(10)), // secret
'phone' => $faker->unique()->randomDigit,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
@@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDeliveryinfosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('deliveryinfos', function (Blueprint $table) {
$table->increments('id');
$table->string('branch');
$table->string('deli_info');
$table->string('address');
$table->string('city');
$table->integer('postcode');
$table->string('state');
$table->string('country');
$table->string('contact_person');
$table->integer('contact_person_no');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('deliveryinfos');
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddColumnToTableDeliveryInfo extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('deliveryinfos', function (Blueprint $table) {
$table->unsignedInteger('com_id');//FK wrn id
$table->foreign('com_id')
->references('id')->on('companies')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('deliveryinfos', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddForeignKeyToWarehousesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('warehouses', function (Blueprint $table) {
$table->unsignedInteger('com_id');//FK wrn id
$table->foreign('com_id')
->references('id')->on('warehouses')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('warehouses', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropAndAddCompanyId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('contacts', function (Blueprint $table) {
//
$table->renameColumn('company_id', 'com_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('contacts', function (Blueprint $table) {
$table->renameColumn('com_id', 'company_id');
});
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropCompanyId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('warehouses', function (Blueprint $table) {
$table->dropColumn('company_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('warehouses', function (Blueprint $table) {
//
});
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class CompanySeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('companies')->insert([
'id' => '999',
'company_name'=>'testing',
'registration_no'=>'testing',
'tax_no'=>'testing',
'tel_no'=>'12345',
'fax'=>'12345',
'address'=>'testing',
'city'=>'testing',
'postcode'=>'12345',
'state'=>'testing',
'country'=>'testing',
'contact_person'=>'testing',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'user_id' => '2'
]);
}
}
+2
View File
@@ -13,5 +13,7 @@ class DatabaseSeeder extends Seeder
{
$this->call(LaratrustSeeder::class);
$this->call(UsersTableSeeder::class);
$this->call(DeliveryInfoSeeder::class);
$this->call(CompanySeeder::class);
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class DeliveryInfoSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('deliveryinfos')->insert([
'id' => '999',
'branch' => 'Testing',
'deli_info' => 'Testing',
'address' => 'Testing',
'city' => 'Test',
'postcode' => '12345',
'state' => 'Testing',
'country' => 'Testing',
'contact_person' => 'Testing',
'contact_person_no' => '12345',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'com_id' => '999'
]);
}
}
+1 -1
View File
@@ -27,6 +27,6 @@
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="MAIL_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
</phpunit>
-6
View File
File diff suppressed because one or more lines are too long
+129 -56
View File
@@ -261,39 +261,37 @@
</label>
</div>
<p class="fix-name fix">Fedrick Darel Auditore</p>
<p class="fix-name fix">Asif Ferdous</p>
<p class="fix-role">Importer</p>
</div>
</div>
<div class="form-label-divider">
<div class="form-label-divider" >
<span class="label-span">Personal Information</span>
</div>
<div class="form-divider"></div>
<div class="form-row txt-center">
<div class="form-row txt-center" data-popup="formPopup23">
<a href="#" style="width:50%; margin-left:25%;" class="button block green">Edit</a>
</div>
<div class="form-divider"></div>
<div class="form-row-group">
<div class="form-row no-padding">
<label id="company-name" type="text" class="form-element">Fedrick Darel</label>
<label id="registration-no" type="text" class="form-element">Asif ferdous</label>
</div>
<div class="form-row no-padding">
<label id="registration-no" type="text" class="form-element">Auditore</label>
<label id="registration-no" type="text" class="form-element">ferdous.asif2012@gmail.com</label>
</div>
<div class="form-row no-padding">
<label id="registration-no" type="text" class="form-element">fedrickdarel@gmail.com</label>
<label id="registration-no" type="text" class="form-element">http://www.ferdous.com</label>
</div>
<div class="form-row no-padding">
<label id="registration-no" type="text" class="form-element">http://www.Azure.com</label>
</div>
<div class="form-row no-padding">
<label id="registration-no" type="text" class="form-element">Founder and CEO</label>
<label id="registration-no" type="text" class="form-element">CEO</label>
</div>
</div>
@@ -322,9 +320,9 @@
<li>
<a href="home.html"><i class="fa fa-home"></i> Home</a>
</li>
<li>
<a href="#"><i class="fa fa-bell"></i> Notice</a>
</li>
<!--<li>-->
<!--<a href="#"><i class="fa fa-bell"></i>piyal</a>-->
<!--</li>-->
<li>
<a href="javascript:void(0);"><i class="fa fa-briefcase"></i> Arrangement <span class="fa fa-angle-down"></span></a>
<ul>
@@ -339,21 +337,21 @@
<li><a href="shipping-order.html" data-loader="show"><i class="fa fa-truck"></i> Shipping Order</a></li>
</ul>
</li>
<li>
<a href="#"><i class="fa fa-comments"></i> Messenger</a>
</li>
<!--<li>-->
<!--<a href="#"><i class="fa fa-comments"></i> Messenger</a>-->
<!--</li>-->
<li>
<a href="javascript:void(0);"><i class="fa fa-shopping-cart"></i> Track Order</a>
</li>
<li>
<a href="example-element.html"><i class="fa fa-code"></i>Example Element <span class="fa fa-angle-down"></span></a>
<ul>
<li><a href="element-wizard.html" data-loader="show"><i class="fa fa-code"></i> Wizard Element</a></li>
<li><a href="#" data-loader="show"><i class="fa fa-code"></i> Accordion Element</a></li>
<li><a href="#" data-loader="show"><i class="fa fa-code"></i> Popup Element</a></li>
<li><a href="element-MTracker.html" data-loader="show"><i class="fa fa-code"></i> Meter Tracker Element</a></li>
</ul>
</li>
<!--<li>-->
<!--<a href="example-element.html"><i class="fa fa-code"></i>Example Element <span class="fa fa-angle-down"></span></a>-->
<!--<ul>-->
<!--<li><a href="element-wizard.html" data-loader="show"><i class="fa fa-code"></i> Wizard Element</a></li>-->
<!--<li><a href="#" data-loader="show"><i class="fa fa-code"></i> Accordion Element</a></li>-->
<!--<li><a href="#" data-loader="show"><i class="fa fa-code"></i> Popup Element</a></li>-->
<!--<li><a href="element-MTracker.html" data-loader="show"><i class="fa fa-code"></i> Meter Tracker Element</a></li>-->
<!--</ul>-->
<!--</li>-->
</ul>
</div>
<!-- Menu navigation end -->
@@ -412,7 +410,7 @@
</div>
<div class="form-row txt-center">
<a href="shipping-order.html" style="width:50%; margin-left:25%;" class="button block blue">Add New SO</a>
<a href="create-shipping-order-S1.html" style="width:50%; margin-left:25%;" class="button block blue">New Shipping Order</a>
</div>
<div class="form-divider"></div>
@@ -611,7 +609,7 @@
</label>
</div>
<p class="fix-name fix">Fedrick Darel Auditore</p>
<p class="fix-name fix">Asif ferdous</p>
<p class="fix-role">Importer</p>
</div>
@@ -635,11 +633,27 @@
</a>
</div>
<div class="profile-menu-branch">
<!--<div class="profile-menu-branch">-->
<!--<a href="#">-->
<!--<img class="avatar-img" src="images/Azure-Branch-Icon.png" width="80" height="80" />-->
<!--<div>-->
<!--Branch Information-->
<!--</div>-->
<!--</a>-->
<!--</div>-->
<div class="profile-menu-xAxisP">
<a href="#">
<img class="avatar-img" src="images/Azure-Branch-Icon.png" width="80" height="80" />
<img class="avatar-img" src="images/Azure-DeliveryIcon.png" width="80" height="80" />
<div>
Branch Information
Delivery Information
</div>
</a>
</div>
<div class="profile-menu-personal">
<a href="#">
<img class="avatar-img" src="images/Azure-Personal-Icon.png" width="80" height="80" />
<div>
Personal Information
</div>
</a>
</div>
@@ -655,27 +669,27 @@
<div class="profile-menu">
<!-- Deliver Profile Start Here -->
<div class="profile-menu-xAxisP">
<a href="#">
<img class="avatar-img" src="images/Azure-DeliveryIcon.png" width="80" height="80" />
<div>
Delivery Information
</div>
</a>
</div>
<!--<div class="profile-menu-xAxisP">-->
<!--<a href="#">-->
<!--<img class="avatar-img" src="images/Azure-DeliveryIcon.png" width="80" height="80" />-->
<!--<div>-->
<!--Delivery Information-->
<!--</div>-->
<!--</a>-->
<!--</div>-->
<!-- Delivery Profile End Here-->
<div class="profile-menu-divider"></div>
<!--<div class="profile-menu-divider"></div>-->
<!-- Branch Profile Start Herer -->
<div class="profile-menu-xAxisM">
<a href="#">
<img class="avatar-img" src="images/Azure-Staff-Icon.png" width="80" height="80" />
<div>
Staff<br />Information
</div>
</a>
</div>
<!--&lt;!&ndash; Branch Profile Start Herer &ndash;&gt;-->
<!--<div class="profile-menu-xAxisM">-->
<!--<a href="#">-->
<!--<img class="avatar-img" src="images/Azure-Staff-Icon.png" width="80" height="80" />-->
<!--<div>-->
<!--Staff<br />Information-->
<!--</div>-->
<!--</a>-->
<!--</div>-->
<!-- Branch Profile End Here -->
</div>
@@ -686,14 +700,14 @@
<!-- Staff Profile Start Here -->
<div class="form-row txt-center">
<div class="profile-menu">
<div class="profile-menu-personal">
<a href="#">
<img class="avatar-img" src="images/Azure-Personal-Icon.png" width="80" height="80" />
<div>
Personal Information
</div>
</a>
</div>
<!--<div class="profile-menu-personal">-->
<!--<a href="#">-->
<!--<img class="avatar-img" src="images/Azure-Personal-Icon.png" width="80" height="80" />-->
<!--<div>-->
<!--Personal Information-->
<!--</div>-->
<!--</a>-->
<!--</div>-->
</div>
</div>
@@ -710,6 +724,65 @@
</div>
<!--POPUP HTML CONTENT START -->
<div class="popup-overlay" id="formPopup23">
<!-- if you dont want overlay add class .no-overlay -->
<div class="popup-container">
<div class="popup-header">
<h3 class="popup-title">Personal Information</h3>
<span class="popup-close" data-dismiss="true"><i class="fa fa-times"></i></span>
</div>
<div class="popup-content">
<div class="form-row-group with-icons-no-padding">
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">Full Name</label>
</div>
<input type="text" class="form-element" placeholder="Asif Ferdous" required />
</div>
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">Email</label>
</div>
<input type="text" class="form-element" placeholder="ferdous.asif2012@gmail.com" required />
</div>
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">Website</label>
</div>
<input type="text" class="form-element" placeholder="http://ferdous.com" required />
</div>
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">Position</label>
</div>
<input type="text" class="form-element" placeholder="CEO" required />
</div>
</div>
</div>
<div class="popup-footer">
<button class="button blue" data-dismiss="true">Save</button>
</div>
</div>
</div>
<!--personal popup -->
<div class="popup-overlay" id="formPopup">
<!-- if you dont want overlay add class .no-overlay -->
<div class="popup-container">
-1
View File
File diff suppressed because one or more lines are too long
+6 -9
View File
@@ -142,7 +142,7 @@
success:function(data){
console.log(data);
for(i=0; i<data.length; i++){
$('#search_results').append('<li style="display: show;"> <a href="#" onclick="displayCompany(' + "'" + data[i].company_name + "'" + ',' + "'" + data[i].tel_no + "'" + ',' + "'" + data[i].contact_person + "'" + ')"> <i class="fa fa-user"></i>' + data[i].company_name + '<span class="list-item-title-role" style="margin-top:-10px">' + data[i].tel_no + '</span> <br> <span class="list-item-title-role" style="margin-top:-10px">'+ data[i].contact_person);
$('#search_results').append('<li style="display: show;"> <a href="#" onclick="displayCompany(' + "'" + data[i].company_name + "'" + ',' + "'" + data[i].tel_no + "'" + ',' + "'" + data[i].contact_person + "'" + ',' + "'" + data[i].com_id + "'" + ')"> <i class="fa fa-user"></i>' + data[i].company_name + '<span class="list-item-title-role" style="margin-top:-10px">' + data[i].tel_no + '</span> <br> <span class="list-item-title-role" style="margin-top:-10px">'+ data[i].contact_person);
}
//$('#searchresults').show();
},
@@ -153,7 +153,7 @@
})
//displayCompany.apply(this, data);
function displayCompany(company_name, tel_no, contact_person){
function displayCompany(company_name, tel_no, contact_person, com_id){
$('#companyname').text(company_name);
$('#telno').text(tel_no);
$('#contactpers').text(contact_person);
@@ -161,17 +161,14 @@
$('#formPopup5').show();
$('#addContact').click(function() {
$.ajax({
type: "",
url: "api/",
type: "POST",
url: "api/contacts",
headers: {"Authorization": 'Bearer' + localStorage.getItem('token')},
data: {
role:$('#role').val(),
name: $('#name').val(),
password: $('#password').val(),
password_confirmation:$('#password_confirmation').val()
com_id: com_id,
},
success: function(data) {
document.location.href="company-profile.html";
console.log(data);
}
})
})
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Create</title>
</head>
<body>
</body>
</html>
@@ -0,0 +1,92 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<style>
html,
body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
.links>a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>
@endauth
</div>
@endif
<div class="content">
<div class="title m-b-md">
<p2>Laravel</p2>
</div>
</div>
</div>
</body>
</html>
-22
View File
@@ -1,22 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
</head>
<body>
<div>
Hi {{ $name }},
<br>
Thank you for creating an account with us. Don't forget to complete your registration!
<br>
Please click on the link below or copy it into the address bar of your browser to confirm your email address:
<br>
<a href="{{ url('user/verify', $verification_code)}}">Confirm my email address </a>
<br/>
</div>
</body>
</html>
+95
View File
@@ -0,0 +1,95 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>
@endauth
</div>
@endif
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div class="links">
<a href="https://laravel.com/docs">Documentation</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">News</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>
</div>
</div>
</body>
</html>
-95
View File
@@ -1,95 +0,0 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>
@endauth
</div>
@endif
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div class="links">
<a href="https://laravel.com/docs">Documentation</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">News</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>
</div>
</div>
</body>
</html>
+39 -6
View File
@@ -12,7 +12,11 @@ use App\Company;
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//Route::middleware('auth:api')->get('/user', function (Request $request) {
// return $request->user();
//});
Route::post('register', 'AuthController@register');
/* Authentication */
Route::post('login', 'AuthController@login');
@@ -32,8 +36,7 @@ Route :: get('/warehouse','WarehouseController@index');
Route :: delete('/contacts/{contacts_id}','ContactController@destroy');
Route :: get('/contacts','ContactController@index');
//Route :: post('/contacts','ContactController@store');
@@ -50,15 +53,45 @@ Route::group(['middleware' => ['jwt.auth']], function() {
return response()->json(['user'=> $request->user()]);
});
// Delivery-Info
Route::get('/deliveryinfo/','DeliveryinfoController@index');
Route::get('/deliveryinfo/{com_id}','DeliveryinfoController@show');
Route::post('/deliveryinfo', 'DeliveryinfoController@store');
Route::put('/deliveryinfo/{com_id}', 'DeliveryinfoController@update');
Route::delete('/deliveryinfo/{com_id}', 'DeliveryinfoController@destroy');
/* Company */
Route::patch('/company', 'CompanyController@update'); //update company information
Route::post('/company/company_profile/', 'CompanyController@companyProfile');//upload company profile picture
Route::post('/company/reg_cert/', 'CompanyController@regCert'); //upload registration certificaate
Route::post('/company/company_profile/', 'CompanyController@companyProfile');//upload company
Route::post('/company/reg_cert/', 'CompanyController@regCert'); //upload registration
/* Contacts */
Route::get('/company/search', 'CompanyController@search');
//Route::get('/company/search/{company_name}', 'CompanyController@search');//search company in contacts
Route :: post('/contacts','ContactController@sendRequest');
Route::post('/contacts/{company_id}/request', 'ContactController@postApprove');
//Route::post()
Route :: delete('/contacts/{contacts_id}','ContactController@destroy');
Route :: get('/contacts','ContactController@index');
});
//Route::post('/company', 'CompanyController@store'); //store company information
//Route::put('/company/{company}', 'CompanyController@update'); //update company information
//Route::get('/company/search/{company_name}', 'CompanyController@search');
/* Contacts */
//Route::get('/company/search', 'CompanyController@search');
//Route::get('/company/search/{company_name}', 'CompanyController@search');//search company in contacts
//Route::post('/contacts/{company_id}/request', 'ContactController@postApprove');
//Route::post('/company', 'CompanyController@uploadImage');
// Route::put('company/{}', function(Request $request, $productId) {
// $product = Company::findOrFail($productId);
// $product->update($request->all());
// return $product;
// });
// Route::put('company/{}', function(Request $request, $companyId) {
// $company = Product::findOrFail($companyId);
// $company->update($request->all());
// return $company;
// });
+10 -3
View File
@@ -11,9 +11,16 @@
|
*/
Route::get('/', function () {
return view('welcome');
});
/* Routes for the DeliveryInfo in profile*/
// Route::get('/company/deliveryinfo','DeliveryinfoController@index');
// Route::get('/company/{com_id}/deliveryinfo','DeliveryinfoController@show');
// Route::post('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@store');
// Route::put('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@edit');
// Route::put('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@update');
// Route::delete('/company/{com_id}/deliveryinfo', 'DeliveryinfoController@delete');
//Route::post('login', 'AuthController@login');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
+86
View File
@@ -0,0 +1,86 @@
<?php
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Artisan;
use App\User;
use App\Company;
use App\Deliveryinfo;
class DeliveryinfoTest extends TestCase
{
protected $company;
protected $user;
public function setUp()
{
parent::setUp();
Artisan::call('db:seed');
$this->user = factory(User::class)->create();
$this->company = $this->user->each(function ($u) {
factory(Company::class)->create([
'user_id' => $u->id,
]);
});
}
// TODO : those test is wrong, please redo later.
// REDO the test
public function testPost()
{
$response = $this->actingAs($this->user)
->postJson('/api/deliveryinfo', [
'branch' => 'Testing',
'deli_info' => 'Testing',
'address' => 'Testing',
'city' => 'Testing',
'postcode' => '12345',
'state' => 'Testing',
'country' => 'Testing',
'contact_person' => 'Testing',
'contact_person_no' => '12345'
]);
$response->assertStatus(201);
}
public function testPut()
{
$response = $this->actingAs($this->user)
->patchJson('/api/deliveryinfo', [
'branch' => 'ChangedTesting',
'deli_info' => 'Testing',
'address' => 'Testing',
'city' => 'Testing',
'postcode' => '12345',
'state' => 'Testing',
'country' => 'Testing',
'contact_person' => 'Testing',
'contact_person_no' => '12345'
]);
$response->assertStatus(200);
}
public function testDELETE()
{
$response = $this->json('DELETE', '/api/deliveryinfo');
$response->assertStatus(204);
}
}
+63 -101
View File
@@ -1,120 +1,82 @@
<?php
namespace Tests\Unit\warehouseTest;
namespace Tests\API;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use App\User;
use App\Company;
use Artisan;
class warehouseTest extends TestCase
class WarehouseTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicExample()
{
$response = $this->json('POST', '/api/contacts', ['ff_id' => '14']);
protected $company;
protected $user;
$response
->assertStatus(201);
// ->assertJson(
// [
// 'success' => true,
// 'message' => 'Success'
// //'response' => [
// // 'id' => $contacts->ff_id,
// // ]
// ]);
public function setUp()
{
parent::setUp();
Artisan::call('db:seed');
$this->user = factory(User::class)->create();
$this->company = $this->user->each(function ($u) {
factory(Company::class)->create([
'user_id' => $u->id,
]);
});
}
public function testGet()
// {
// $response = $this->json('GET', '/api/contacts');
//
// $response
// ->assertStatus(200);
//
// }
{
$response = $this->get('/api/contacts');
$response->assertStatus(200);
}
// public function testUPdate()
// {
//
// $response = $this->json('PUT', '/api/warehouse/{war_id}' . $article->id, $payload, $headers)
// ->assertStatus(200)
// ->assertJson([
// 'id' => 1,
// 'title' => 'Lorem',
// 'body' => 'Ipsum'
// ]);
// }
// public function testPostWarehouse()
// {
// $response = $this->json('POST', '/api/warehouse', [
//
// 'address'=> '2d',
// 'city'=>'cj ',
// 'zip'=>' 123',
// 'state' =>' sl',
// 'contact_person' =>'asif ',
// 'contact_person_no' =>'1212122 ',
// 'branch'=>'yap ',
// 'country' =>' ba',
// 'company_id' =>'1212 '
//
//
//
//
//
//
// ]);
//
// $response
// ->assertStatus(201);
//// ->assertJson([
//// 'created' => true,
// // ]
// //);
// }
public function testPutWarehouse()
{
$response = $this->json('PUT', '/api/warehouse/6', [
'address'=> '2g',
'city'=>'cj ',
'zip'=>' 123',
'state' =>' sl',
'contact_person' =>'tuytguy',
'contact_person_no' =>'1212122 ',
'branch'=>'yap ',
'country' =>' ba',
'company_id' =>'1212 '
public function testPost()
{
$response = $this->actingAs($this->user)
->postJson('/api/warehouse', [
'address'=> 'Testing',
'city'=>'Testing ',
'zip'=>' Testing',
'state' =>'Testing',
'contact_person' =>'Testing ',
'contact_person_no' =>'12345 ',
'branch'=>'Testing ',
'country' =>' Testing',
'com_id' =>'99'
]);
$response
->assertStatus(200);
// ->assertJson([
//
// ]
// );
$response->assertStatus(201);
}
public function testUpdate()
{
$response = $this->actingAs($this->user)
->patchJson('/api/warehouse', [
'address' => 'Changed Testing',
'city' => 'Testing ',
'zip' => ' Testing',
'state' => 'Testing',
'contact_person' => 'Testing ',
'contact_person_no' => '12345 ',
'branch' => 'Testing ',
'country' => ' Testing',
'com_id' => '99'
]);
$response->assertStatus(201);
}
public function testDelete()
{
$this->actingAs($this->user)
->json('DELETE', '/api/so/99');
$response->assertStatus(204);
}
}