Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into zain/shipping-order

# Conflicts:
#	Dockerfile
#	app/Http/Controllers/AuthController.php
#	app/User.php
#	database/factories/UserFactory.php
#	database/migrations/2018_04_25_084609_change_email_to_mobile_from_user.php
#	database/seeds/DatabaseSeeder.php
#	public/home.html
#	public/index.html
#	public/profile-first-setup.html
#	public/verify-code-number.html
#	public/verify-phone-number.html
#	routes/api.php
#	routes/web.php
#	tests/Feature/LoginTest.php
#	tests/Feature/RegisterTest.php
This commit is contained in:
Jack Goh
2018-06-28 16:58:01 +08:00
49 changed files with 15458 additions and 263 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
FROM php:7
RUN apt-get update -y && apt-get install -y openssl zip unzip git netcat
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
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App;
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 = [];
public function user()
{
return $this->belongsTo('App\User');
}
public function deliveryinfo() {
return $this->hasMany('App\Deliveryinfo');
}
}
+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');
}
}
+28 -14
View File
@@ -7,6 +7,7 @@ use App\PasswordResets;
use JWTAuth;
use Auth;
use App\Role;
use App\Company;
use Aloha\Twilio\Twilio;
use Tymon\JWTAuth\Exceptions\JWTException;
@@ -30,10 +31,14 @@ class AuthController extends Controller
public function sendVerification(Request $request){
$credentials = $request->only('phone');
$rules = [
'phone' => 'required|digits:10|unique:users'
'phone' => 'required|digits_between:10,11|unique:users'
];
$validator = Validator::make($credentials, $rules);
if($validator->fails()){
return response()->json(['success'=> false, 'message'=> 'The minimum length should be 10.' ], 400);
}
// create user if not exist
$user = User::firstOrNew([
'phone' => $request->phone
@@ -41,24 +46,24 @@ class AuthController extends Controller
$user->save();
// create token if not exist, update if exist
$token = mt_rand(0000,9999);
$token = mt_rand(0000,9999);
// for testing
// for testing
if($request->phone == '0123456789'){
$token = "1234";
}
$user_verification = $user->phoneVerification()->firstOrNew([
'user_id' => $user->id,
]);
$user_verification->token = $token;
$user_verification->save();
// TODO: send token to phone
// TODO: send token to phone
//$message = "RM0.00 IZYIM: Verification code : ". $token;
//$twilio = new Twilio(env('TWILIO_ACC'), env('TWILIO_TOKEN'), env('TWILIO_NUMBER'));
//$twilio->message($request->phone, $message);
return response()->json(['success'=> true, 'message'=> 'A verification code has been send to your mobile number.' ]);
return response()->json(['success'=> true, 'message'=> 'A verification code has been send to your mobile number.' ], 200);
}
@@ -79,14 +84,14 @@ class AuthController extends Controller
return response()->json([
'success'=> true,
'message'=> 'Account already verified.'
]);
], 200);
}
}
else{
return response()->json([
'success'=> false,
'message'=> 'Please contact support.'
]);
], 400);
}
// check and verify valid token
@@ -99,14 +104,17 @@ class AuthController extends Controller
if (!$userToken=JWTAuth::fromUser($check_user)) {
return response()->json(['error' => 'invalid_credentials'], 401);
}
// TODO : Create company for user
$expiration = JWTAuth::setToken($userToken)->getPayload()->get('exp');
// all good so return the token
return response()->json(['success' => true, 'token' => $userToken,
'token_type' => 'bearer',
'expires_in' => $expiration - time()]);
}
return response()->json(['success'=> false, 'error'=> "Verification code is invalid."]);
return response()->json(['success'=> false, 'error'=> "Verification code is invalid."], 400);
}
/**
@@ -127,9 +135,8 @@ class AuthController extends Controller
$validator = Validator::make($credentials, $rules);
if($validator->fails()) {
return response()->json(['success'=> false, 'error'=> $validator->messages()]);
return response()->json(['success'=> false, 'error'=> $validator->messages()], 400);
}
$name = $request->name;
$password = $request->password;
$role = $request->role;
@@ -142,7 +149,14 @@ class AuthController extends Controller
// attach role to user
$user->attachRole($role);
$user->update(['name' => $name, 'password' => Hash::make($password)]);
return response()->json(['success'=> true, 'message'=> 'Profile updated.']);
// TODO : create company for user
$company = new Company;
$company->user_id = $user->id;
$company->save();
return response()->json(['success'=> true, 'message'=> 'Profile updated.'], 200);
}
@@ -170,7 +184,7 @@ class AuthController extends Controller
try {
// attempt to verify the credentials and create a token for the user
if (! $token = JWTAuth::attempt($credentials)) {
return response()->json(['success' => false, 'error' => 'We cant find an account with this credentials. Please make sure you entered the right information and you have verified your email address.'], 401);
return response()->json(['success' => false, 'error' => 'Phone or password incorrect'], 401);
}
} catch (JWTException $e) {
// something went wrong whilst attempting to encode the token
+126
View File
@@ -0,0 +1,126 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Company;
use Illuminate\Support\Facades\Storage;
use Validator;
use Auth;
class CompanyController extends Controller
{
public function update(Request $request)
{
$company = Company::where("user_id", Auth::user()->id)->first();
if (!$company)
{
return response()->json(['success'=> false, 'message'=>'Company not found'], 404);
}
$rules = [
'company_name' => 'required',
'registration_no' => 'required',
'tax_no' => 'required',
'tax_no' => 'required',
'tel_no' => 'required',
'fax' => 'required',
'address' => 'required',
'city' => 'required',
'postcode' => 'required',
'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);
}
$company->company_name=$request->input('company_name');
$company->registration_no=$request->input('registration_no');
$company->tax_no=$request->input('tax_no');
$company->tel_no=$request->input('tel_no');
$company->fax=$request->input('fax');
$company->address=$request->input('address');
$company->city=$request->input('city');
$company->postcode=$request->input('postcode');
$company->state=$request->input('state');
$company->country=$request->input('country');
$company->contact_person=$request->input('contact_person');
$company->save();
return response()->json(['success'=> true, 'message'=>'Company created successfully'],200);
}
public function companyProfile(Request $request)
{
$company = Company::where("user_id", Auth::user()->id)->first();
if (!$company)
{
return response()->json(['success'=> false, 'error'=>'Company not found'], 404);
}
//validaating file types
$validator = Validator::make($request->all(), [
'company_profile' => 'image|mimes:jpg,jpeg,bmp,png'
]);
if($validator->fails())
{
return response()->json(['success'=> false, 'error'=>'Incorrect format'], 400);
}
if($file = $request->file('company_profile')) //company profile picture
{
$company_profile = $request->file('company_profile');
$filename = $company_profile->getClientOriginalName(); //get the original file name
$unique_name = 'comp_prof_' . md5($filename. time()); //generating a random file name
$file = $request->file('company_profile');
$ext = $file->getClientOriginalExtension();
$input['company_profile'] = $filename;
Storage::putFileAs(
'company_profile',/*folder name*/ $file, $unique_name. '.' .$ext
);
$company->company_profile = $unique_name. '.' .$ext; //update database
} //end if
$company->save();
return response()->json(['success'=> true, 'message'=>'Company profile picture uploaded successfully'],200);
}//end of companyProfile()
public function regCert(Request $request)
{
$company = Company::where("user_id", Auth::user()->id)->first();
if (!$company)
{
return response()->json(['success'=> false, 'error'=>'Company not found'], 404);
}
//validating file types
$validator = Validator::make($request->all(), [
'reg_cert' => 'mimes:jpg,jpeg,bmp,png,gif,svg,pdf'
]);
if($validator->fails()){
return response()->json(['success'=> false, 'error'=>'Incorrect format'], 400);
}
if($request->hasFile('reg_cert')) //Registration Certificate upload
{
$reg_cert = $request->file('reg_cert');
$filename = $reg_cert->getClientOriginalName(); //original filename
$unique_name = 'reg_cert_' . md5($filename. time()); //generating a random file name
$file = $request->file('reg_cert');
$ext = $file->getClientOriginalExtension();
$input['reg_cert'] = $filename;
Storage::putFileAs(
'reg_cert',/*folder name*/ $file, $unique_name. '.' .$ext
);
$company->reg_cert = $unique_name. '.' .$ext; //this updates database
}//end if
$company->save();
return response()->json(['success'=> true, 'message'=>'Registration Certificate uploaded successfully'], 200);
}//end regCert()
}//end of class
@@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Deliveryinfo;
use Auth;
class DeliveryinfoController extends Controller
{
public function index()
{
$deliveryinfo = Deliveryinfo::where('com_id', Auth::user()->company())->get();
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)->firstOrFail();
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);
}
}
+5
View File
@@ -54,4 +54,9 @@ class User extends Authenticatable implements JWTSubject
return $this->hasOne('App\UserVerification', 'user_id');
}
public function company()
{
return $this->hasOne('App\Company');
}
}
+1
View File
@@ -9,6 +9,7 @@
"aloha/twilio": "^4.0",
"doctrine/dbal": "~2.3",
"fideloper/proxy": "^4.0",
"intervention/image": "^2.4",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"santigarcor/laratrust": "5.0.*",
Generated
+185
View File
@@ -787,6 +787,141 @@
],
"time": "2018-02-07T20:20:57+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"request",
"response",
"stream",
"uri",
"url"
],
"time": "2017-03-20T17:10:46+00:00"
},
{
"name": "intervention/image",
"version": "2.4.1",
"source": {
"type": "git",
"url": "https://github.com/Intervention/image.git",
"reference": "3603dbcc9a17d307533473246a6c58c31cf17919"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/3603dbcc9a17d307533473246a6c58c31cf17919",
"reference": "3603dbcc9a17d307533473246a6c58c31cf17919",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"guzzlehttp/psr7": "~1.1",
"php": ">=5.4.0"
},
"require-dev": {
"mockery/mockery": "~0.9.2",
"phpunit/phpunit": "^4.8 || ^5.7"
},
"suggest": {
"ext-gd": "to use GD library based image processing.",
"ext-imagick": "to use Imagick based image processing.",
"intervention/imagecache": "Caching extension for the Intervention Image library"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
},
"laravel": {
"providers": [
"Intervention\\Image\\ImageServiceProvider"
],
"aliases": {
"Image": "Intervention\\Image\\Facades\\Image"
}
}
},
"autoload": {
"psr-4": {
"Intervention\\Image\\": "src/Intervention/Image"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Oliver Vogel",
"email": "oliver@olivervogel.com",
"homepage": "http://olivervogel.com/"
}
],
"description": "Image handling and manipulation library with support for Laravel integration",
"homepage": "http://image.intervention.io/",
"keywords": [
"gd",
"image",
"imagick",
"laravel",
"thumbnail",
"watermark"
],
"time": "2017-09-21T16:29:17+00:00"
},
{
"name": "jakub-onderka/php-console-color",
"version": "0.1",
@@ -1605,6 +1740,56 @@
],
"time": "2017-02-14T16:28:37+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
"version": "1.0.2",
+2 -3
View File
@@ -1,7 +1,7 @@
<?php
return [
//'fileDestinationPath' => 'uploads',
/*
|--------------------------------------------------------------------------
| Application Name
@@ -160,8 +160,7 @@ return [
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\RouteServiceProvider::class
],
/*
+16 -1
View File
@@ -43,7 +43,7 @@ return [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'database' => env('DB_DATABASE', 'forgzze'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
@@ -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',
+30
View File
@@ -0,0 +1,30 @@
<?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
// Manually creating the relationship tree.
$factory->define(App\Company::class, function (Faker $faker) {
return [
'company_name'=>'testing',
'registration_no'=>'testing',
'tax_no'=>'testing',
'tel_no'=>'12345',
'fax'=>'12345',
'address'=>'testing',
'city'=>'testing',
'postcode'=>'testing',
'state'=>'testing',
'country'=>'testing',
'contact_person'=>'testing'
];
});
+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,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCompaniesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('companies', function (Blueprint $table) {
$table->increments('id');
$table->string('company_profile');//->default('default.jpg'); //need to check about storage type
$table->string('reg_cert');
$table->string('company-name');
$table->string('registration-no');
$table->string('tax-no');
$table->integer('tel-no');
$table->integer('fax');
$table->string('address');
$table->string('city');
$table->string('postcode');
$table->string('state');
$table->string('country');
$table->string('contact-person');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('companies');
}
}
@@ -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,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameColumnInCompany extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
// $table->renameColumn('company-profile', 'company_profile');
$table->renameColumn('"company-name"', 'company_name');
$table->renameColumn('"registration-no"', 'registration_no');
$table->renameColumn('"tax-no"', 'tax_no');
$table->renameColumn('"tel-no"', 'tel_no');
$table->renameColumn('"contact-person"', 'contact_person');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -25,6 +25,6 @@ class ChangeEmailToMobileFromUser extends Migration
*/
public function down()
{
$table->renameColumn('phone', 'email');
//$table->renameColumn('phone', 'email');
}
}
@@ -0,0 +1,45 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNullableToCompanies extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
//
$table->string('company_profile')->nullable()->change(); //need to check about storage type
$table->string('reg_cert')->nullable()->change();
$table->string('company_name')->nullable()->change();
$table->string('registration_no')->nullable()->change();
$table->string('tax_no')->nullable()->change();
$table->integer('tel_no')->nullable()->change();
$table->integer('fax')->nullable()->change();
$table->string('address')->nullable()->change();
$table->string('city')->nullable()->change();
$table->string('postcode')->nullable()->change();
$table->string('state')->nullable()->change();
$table->string('country')->nullable()->change();
$table->string('contact_person')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('companies', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddUserToCompanyTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
$table->unsignedInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -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) {
//
});
}
}
+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
@@ -14,5 +14,7 @@ class DatabaseSeeder extends Seeder
$this->call(SoSeeder::class);
$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'
]);
}
}
+13702
View File
File diff suppressed because it is too large Load Diff
+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>
+205
View File
@@ -0,0 +1,205 @@
<html>
<head>
<title>AzureUI - Term</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/global.style.css" />
<style>
.header {
width:relative;
margin: 0 auto;
height: 30px;
}
#backbtn {
padding: 20px;
float:left;
}
#heading {
float:right;
padding: 20px;
clear: right;
}
</style>
</head>
<body>
<!-- Header area start-->
<div class="header">
<div id="backbtn">
<a class="go-back-linkC"><i class="fa fa-arrow-left"></i></a>
</div>
<div id="heading">
<h1 class="page-title" style="color: #000">Company Profile</h1>
</div>
</div>
<!-- Header area end -->
<!-- Main Content Start Here -->
<div class="container">
<main class="fix-top-menu">
<section class="container">
<!--company profile
<form>
<div class="form-row txt-center">
<div class="profile-image">
<div class="profile-image-com">
<img id="CompanyProfile" class="avatar-img" src="images/CIEF.png" width="80" height="80" />
<label class="update-btn fix">
<input id="CompanyUpload" type="file" style="display:none" />
<i class="fa fa-camera"></i>
</label>
</div>
</div>
</div>
</form>
-->
<br>
<form>
<div class="form-row txt-center">
<b>Please upload the registration certificate.</b>
<label class="update-btn fix">
<div class="form-row txt-center">
<input id="reg_cert" type="file" />
<div class="form-divider"></div>
<a href="#" id="regCert" style="width:50%; margin-left:25%;" class="button block green">Upload</a>
</div>
</label>
</div>
</form>
<div class="form-divider"></div>
<div class="alert alert-danger" id="alert" role="alert" style="display: none"></div>
<div class="alert alert-success" id="alert1" role="alert1" style="display: none"></div>
<br>
<div class="form-label-divider">
<span class="label-span">Company Information</span>
</div>
<div class="form-divider"></div>
<div class="alert alert-danger" id="alert2" role="alert2" style="display: none"></div>
<form>
<div class="form-row-group">
<div class="form-row no-padding">
<input id="company-name" type="text" class="form-element" placeholder="Company Name" required />
</div>
<div class="form-row no-padding">
<input id="registration-no" type="text" class="form-element" placeholder="Registration No" required />
</div>
<div class="form-row no-padding">
<input id="tax-no" type="text" class="form-element" placeholder="Tax No" required />
</div>
<div class="form-row no-padding">
<input id="tel-no" type="text" class="form-element" placeholder="Tel No" required />
</div>
<div class="form-row no-padding">
<input id="fax" type="text" class="form-element" placeholder="Fax" required />
</div>
<div class="form-row no-padding">
<input id="address" type="text" class="form-element" placeholder="Address" required />
</div>
<div class="form-row no-padding">
<input id="city" type="text" class="form-element" placeholder="City" required />
</div>
<div class="form-row no-padding">
<input id="postcode" type="text" class="form-element" placeholder="Postcode" required />
</div>
<div class="form-row no-padding">
<input id="state" type="text" class="form-element" placeholder="State" required />
</div>
<div class="form-row no-padding">
<input id="country" type="text" class="form-element" placeholder="Country" required />
</div>
<div class="form-row no-padding">
<input id="contact-person" type="text" class="form-element" placeholder="Contact Person" required />
</div>
</div>
<div class="form-divider"></div>
<div class="form-row txt-center">
<a href="#" id="companyDetails" style="width:50%; margin-left:25%;" class="button block green">Submit</a>
</div>
</form>
</section>
</main>
</div>
<!-- Main Content End Here -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#regCert').click(function() {
var fd = new FormData();
var files = $('#reg_cert')[0].files[0];
fd.append('reg_cert',files);
$.ajax({
type: "POST",
url: "api/company/reg_cert/",
headers: {"Authorization": 'Bearer' + localStorage.getItem('token')},
data:fd,
contentType: false,
cache: false,
processData: false,
success: function(data) {
document.getElementById("alert").style.display = "none";
console.log(data.message);
$('#alert1').html(data.message);
$('#alert1').show();
},
error: function(data) {
console.log(data);
document.getElementById("alert1").style.display = "none";
$('#alert').html(data.responseJSON.error);
$('#alert').show();
}
});
})
$('#companyDetails').click(function() {
$.ajax({
type: "PATCH",
url: "api/company",
headers: {"Authorization": 'Bearer' + localStorage.getItem('token')},
data: {
company_name: $('#company-name').val(),
registration_no: $('#registration-no').val(),
tax_no: $('#tax-no').val(),
tel_no: $('#tel-no').val(),
fax: $('#fax').val(),
address: $('#address').val(),
city: $('#city').val(),
postcode: $('#postcode').val(),
state: $('#state').val(),
country: $('#country').val(),
contact_person: $('#contact-person').val()
},
success: function(data) {
//alert("success");
document.location.href="home.html";
},
error: function(data) {
//console.log(data);
$('#alert2').html(data.responseJSON.error);
$('#alert2').show();
}
});
})
})
</script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

-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">
+10 -4
View File
@@ -4,6 +4,7 @@
<title>AzureUI - SIGNIN</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/global.style.css">
@@ -21,6 +22,9 @@
<section class="container">
<form>
@csrf
<div class="alert alert-danger" role="alert" style="display: none">
</div>
<div class="form-row-group with-icons">
<div class="form-row no-padding">
<div style="position:absolute; top: 10px;">
@@ -46,7 +50,6 @@
<div class="form-row">
<a href="#" id="login" class="button block green" type="submit">Sign In</a>
<a href="home.html" class="button block green" id="signin">Sign In</a>
</div>
</form>
@@ -61,6 +64,8 @@
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#login').click(function() {
@@ -74,10 +79,11 @@
success: function(data) {
localStorage.token = data.data.token;
document.location.href="home.html";
alert('Got a token from the server! Token: ' + data.data.token);
},
error: function() {
alert("Login Failed");}
error: function(data) {
$('.alert').html(data.responseJSON.error);
$('.alert').show();
}
});
})
})
-1
View File
File diff suppressed because one or more lines are too long
+50 -22
View File
@@ -4,6 +4,7 @@
<title>AzureUI - Term</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/global.style.css" />
@@ -42,53 +43,47 @@
<div class="form-divider"></div>
<div class="alert alert-danger" id="alert" role="alert" style="display: none"></div>
<div class="form-divider"></div>
<div class="form-row-group with-icons-no-padding">
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">Role</label>
</div>
<select class="form-element">
<select id="role" class="form-element">
<option value="">Please select your role</option>
<option value="1">Freight Forwarder</option>
<option value="2">Importer</option>
</select>
</div>
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">First Name</label>
<label style="color: #000">Full Name</label>
</div>
<input type="text" class="form-element" placeholder="Fedrick Darel" required />
<input id="name"type="text" class="form-element" placeholder="Enter your full name" required />
</div>
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">Last Name</label>
<label style="color: #000">Password</label>
</div>
<input type="text" class="form-element" placeholder="Auditore" required />
<input id="password" type="password" class="form-element" placeholder="Enter your Password" required />
</div>
<div class="form-row no-padding">
<div class="form-element-title">
<label style="color: #000">E-Mail</label>
<label style="color: #000">Confirm Password</label>
</div>
<input type="text" class="form-element" placeholder="fedrickdarel@gmail.com" required />
<input id="password_confirmation" type="password" class="form-element" placeholder="Enter the password again" 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://www.Azure.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 class="form-divider"></div>
<div class="form-row txt-center">
<a href="index.html" class="button block green">FINISH</a>
<a href="#" id="pers-info" class="button block green">FINISH</a>
</div>
<div class="form-divider"></div>
@@ -104,6 +99,39 @@
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/global.script.js"></script>
<!-- Require For All Pages -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#pers-info').click(function() {
$.ajax({
type: "PATCH",
url: "api/user",
headers: {"Authorization": 'Bearer' + localStorage.getItem('token')},
data: {
role:$('#role').val(),
name: $('#name').val(),
password: $('#password').val(),
password_confirmation:$('#password_confirmation').val()
},
success: function(data) {
document.location.href="company-profile.html";
},
error: function(data) {
var errors = $.parseJSON(data.responseText);
//console.log(errors.error);
if (errors != null){
for (var i in errors.error) {
//console.log(errors.error[i][0]);
$('.alert').append(errors.error[i][0] + "<br/>");
}
}
$('.alert').show();
}
})
})
});
</script>
</body>
</html>
+56 -6
View File
@@ -4,6 +4,7 @@
<title>AzureUI - Term</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/global.style.css" />
@@ -15,15 +16,18 @@
<div class="form-divider"></div>
<div class="form-row txt-center aztitle">
Verify +60 19-795-1905
Verify Phone
</div>
<div class="form-row txt-center">
Waiting to automatically detect an SMS sent to <b>+60 19-795 1905</b>.<a> Wrong number?</a>
A verification code has been send to <b><span id="phone"></span></b>.<a><br> Wrong number?</a>
</div>
<div class="form-divider"></div>
<!--Error Alert-->
<div class="alert alert-danger" role="alert" style="display: none"></div>
<!-- Here Lies Main Start Here -->
<main>
<section class="container">
@@ -32,15 +36,15 @@
<div class="form-element-code">
<label style="color: #000">Enter Verification Code</label>
</div>
<input type="text" class="form-element-code-input" placeholder="" required />
<input type="text" id="verify-code" class="form-element-code-input" placeholder="" required />
</div>
</div>
<!-- AzFooter Start Here-->
<div class="azfooter-code">
<div class="azfmain-button">
<div class="azfooter-code" id="btn-verify" style="margin-top:50px">
<div class="azfmain-button" >
<div class="form-row txt-center">
<a href="profile-first-setup.html" class="button block green">NEXT</a>
<a href="#" class="button block green">NEXT</a>
</div>
</div>
</div>
@@ -51,6 +55,52 @@
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script type="text/javascript">
function readCookie(name) {
var nameEQ = encodeURIComponent(name) + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) === ' ')
c = c.substring(1, c.length);
if (c.indexOf(nameEQ) === 0)
return decodeURIComponent(c.substring(nameEQ.length, c.length));
}
return null;
}
var phone = readCookie('phone');
document.getElementById("phone").innerHTML = phone;
$(document).ready(function() {
$('#btn-verify').click(function() {
$.ajax({
type: "POST",
url: "api/verify-phone",
data: {
phone: phone,
token: $('#verify-code').val()},
success: function(data) {
if( data.success){
localStorage.token = data.token;
document.location.href="profile-first-setup.html";
}
else{
//console.log('wrong code');
$('.alert').html(data.success.message);
$('.alert').show();
}
//
},
error: function(data) {
$('.alert').html(data.responseJSON.error);
$('.alert').show();}
});
})
})
</script>
</body>
</html>
+55 -11
View File
@@ -4,12 +4,13 @@
<title>AzureUI - Term</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="css/global.style.css" />
</head>
<body>
<body>
<div class="wrapper">
<div class="wrapper-inline">
<div class="form-divider"></div>
@@ -19,15 +20,16 @@
</div>
<div class="form-row txt-center">
IZYIM will send an SMS message to verify your phone number. Enter your country code and phone number:
IZYIM will send an SMS message to verify your phone number. Enter your country code and phone number:
</div>
<div class="form-divider"></div>
<!-- Here Lies Main Start Here -->
<main>
<section class="container">
<form></form>
<form>
@csrf
<div class="form-row-group with-icons">
<div class="form-row no-padding">
@@ -36,8 +38,8 @@
</div>
<select class="form-element">
<option value="">Select your country</option>
<option value="1" selected>Malaysia</option>
<option value="2">China</option>
<option value="1" selected>Malaysia +6</option>
<option value="2">China +86</option>
</select>
</div>
@@ -45,15 +47,20 @@
<div style="position:absolute; top:10px">
<a class="fa fa-phone"></a>
</div>
<input id="mobile" type="text" class="form-element" placeholder="Enter your phone number" />
<input id="mobile" type="tel" class="form-element" placeholder="Enter your phone number" required />
</div>
</div>
<div class="form-divider"></div>
<!--Error Alert-->
<div class="alert alert-danger" role="alert" style="display: none"></div>
<!-- AzFooter Start Here-->
<div class="azfooter">
<div class="azfmain-button">
<div class="form-row txt-center">
<a href="verify-code-number.html" class="button block green">NEXT</a>
<a href="#" id="send-verification" class="button block green">NEXT</a>
</div>
</div>
<div class="azfmain-txt">
@@ -61,14 +68,51 @@
Carrier SMS charges may apply
</div>
</div>
</div>
<!-- AzFooter Ended Here -->
</div> <!-- AzFooter Ended Here -->
</form>
</section>
</main>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script type="text/javascript">
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
}
$(document).ready(function() {
$('#send-verification').click(function() {
var mobile = $('#mobile').val();
$.ajax({
type: "POST",
url: "api/send-verification",
data: {
phone: $('#mobile').val()},
success: function(data) {
document.location.href="verify-code-number.html";
},
Cookies:createCookie('phone', mobile, 60),
error: function(data) {
$('.alert').html(data.responseJSON.message);
$('.alert').show();
}
});
})
})
</script>
</body>
</html>
@@ -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>
View File
-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>
+19 -11
View File
@@ -1,8 +1,6 @@
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
@@ -14,16 +12,20 @@ use Illuminate\Http\Request;
|
*/
//Route::middleware('auth:api')->get('/user', function (Request $request) {
// return $request->user();
//});
//Route::post('register', 'AuthController@register');
Route::post('register', 'AuthController@register');
/* Authentication */
Route::post('login', 'AuthController@login');
Route::post('password/recover', 'AuthController@recover');
Route::post('password/reset', 'AuthController@reset');
Route::post('send-verification', 'AuthController@sendVerification');
Route::post('verify-phone', 'AuthController@verifyPhone');
@@ -34,11 +36,17 @@ Route::group(['middleware' => ['jwt.auth']], function() {
return response()->json(['user'=> $request->user()]);
});
/* shipping order */
Route::get('/so', 'SoController@showso');//get the shipping order
Route::post('/so', 'SoController@store');//store shipping order
Route::delete('/so/{so_id}', 'SoController@delete');// delete the shipping order
Route::put('/so/{so_id}/cancelOrder', 'SoController@cancelOrder');//post the cancel order
Route::put('/so/{so_id}', 'SoController@update');//update the shipping order
/*Delivery-Info in profile menu*/
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
});
+10 -4
View File
@@ -11,12 +11,18 @@
|
*/
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');
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
-2
View File
@@ -1,2 +0,0 @@
*
!.gitignore
+74
View File
@@ -0,0 +1,74 @@
<?php
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Artisan;
use App\User;
use App\Company;
class CompanyTest 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,
]);
});
}
public function testUpdateCompany()
{
$response = $this->actingAs($this->user)
->patchJson('/api/company', [
'company_name'=>'changed testing',
'registration_no'=>'testing',
'tax_no'=>'testing',
'tel_no'=>'12345',
'fax'=>'12345',
'address'=>'testing',
'city'=>'testing',
'postcode'=>'testing',
'state'=>'testing',
'country'=>'testing',
'contact_person'=>'testing',
]);
$response->assertStatus(200);
}
public function testUploadCompanyProfile()
{
Storage::fake('company_profile');
$response = $this->actingAs($this->user)
->json('POST', '/api/company/company_profile/', [
'company_profile' => UploadedFile::fake()->image('comp.jpg')
]);
// dd($response->getContent());
$response->assertStatus(200);
}
public function testUploadRegCert()
{
Storage::fake('reg_cert');
$response = $this->actingAs($this->user)
->json('POST', '/api/company/reg_cert/', [
'reg_cert' => UploadedFile::fake()->create('document.pdf')//, $sizeInKilobytes)
]);
$response->assertStatus(200);
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ class LoginTest extends TestCase
*
* @return void
*/
public function testExample()
public function testLogin()
{
$response = $this->json('POST', '/api/login', ['phone' => '0123456789','password' => 'secret']);
$response
+1 -1
View File
@@ -26,7 +26,7 @@ class RegisterTest extends TestCase
'success' => true,
]);
$response = $this->json('POST', '/api/verify', ['phone' => '0123456789', 'token' => '1234']);
$response = $this->json('POST', '/api/verify-phone', ['phone' => '0123456789', 'token' => '1234']);
$response
->assertStatus(200)
->assertJson([
+84
View File
@@ -0,0 +1,84 @@
<?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.
// public function testCreate()
// {
// $response = $this->actingAs($this->company)
// ->patchJson('/api/deliveryinfo', [
// 'branch' => 'Test',
// 'deli_info' => 'Testing',
// 'address' => 'Testing',
// 'city' => 'Test',
// 'postcode' => '12345',
// 'state' => 'Testing',
// 'country' => 'Testing',
// 'contact_person' => 'Testing',
// 'contact_person_no' => '12345'
// ]);
// $response->assertStatus(201);
// }
// public function testPUT()
// {
// $response = $this->actingAs($this->company)
// ->patchJson('/api/deliveryinfo', [
// 'branch' => 'Test',
// 'deli_info' => 'Testing',
// 'address' => 'Testing',
// 'city' => 'Test',
// '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);
// }
}