Compare commits
2 Commits
7aebd63f76
...
6bd3b3fca8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bd3b3fca8 | ||
|
|
3632ae71c1 |
59
.env.example
Normal file
59
.env.example
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=laravel
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=mailpit
|
||||||
|
MAIL_PORT=1025
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS="hello@example.com"
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_HOST=
|
||||||
|
PUSHER_PORT=443
|
||||||
|
PUSHER_SCHEME=https
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
VITE_APP_NAME="${APP_NAME}"
|
||||||
|
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||||
|
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||||
|
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||||
|
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||||
@ -7,8 +7,6 @@
|
|||||||
use App\Models\Agent;
|
use App\Models\Agent;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
@ -81,7 +79,9 @@ protected function create(array $data)
|
|||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'inn' => $data['inn'],
|
'inn' => $data['inn'],
|
||||||
'email' => $data['email'],
|
'email' => $data['email'],
|
||||||
'type' => $data['type']
|
'type' => $data['type'],
|
||||||
|
'secret' => bin2hex(random_bytes(16)),
|
||||||
|
'status' => 'new'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Agent::create([
|
Agent::create([
|
||||||
|
|||||||
@ -13,10 +13,11 @@ public function index() {
|
|||||||
$admin = CompanyAdmin::where('user_id', $user->id);
|
$admin = CompanyAdmin::where('user_id', $user->id);
|
||||||
if ($admin->count()) {
|
if ($admin->count()) {
|
||||||
$admin = $admin->first();
|
$admin = $admin->first();
|
||||||
return view('agent.table', [
|
return view('company.agents.table', [
|
||||||
'agents' => Agent::where('company_id', $admin->company_id)->get()
|
'agents' => Agent::where('company_id', $admin->company_id)->get()
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
|
echo 'has no permissions';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
38
app/Http/Controllers/Company/ConfirmCompanyController.php
Normal file
38
app/Http/Controllers/Company/ConfirmCompanyController.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Company;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
|
||||||
|
use App\Models\Company\Company;
|
||||||
|
use App\Models\Company\CompanyAdmin;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class ConfirmCompanyController extends Controller
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request)
|
||||||
|
{
|
||||||
|
$company = Company::find($request->company_id);
|
||||||
|
if ($company->secret == $request->secret) {
|
||||||
|
$company->status = $request->status;
|
||||||
|
$company->save();
|
||||||
|
$user = User::where('email', $company->email);
|
||||||
|
if ($user->count() == 1) {
|
||||||
|
$user = $user->first();
|
||||||
|
} else {
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $request->user_name,
|
||||||
|
'email' => $company->email,
|
||||||
|
'phone' => $request->user_phone,
|
||||||
|
'password' => uniqid(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
CompanyAdmin::create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'company_id' => $company->id
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\Company;
|
use App\Models\Company\Company;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Models\Bitrix\SendCompany;
|
||||||
class CreateCompanyController extends Controller
|
class CreateCompanyController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -13,9 +15,16 @@ class CreateCompanyController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function __invoke(Request $request)
|
public function __invoke(Request $request)
|
||||||
{
|
{
|
||||||
$company = Company::create($request->only('name', 'email', 'inn', 'legal_address'));
|
$request->request->add([
|
||||||
|
'secret' => bin2hex(random_bytes(16)),
|
||||||
|
'status' => 'new',
|
||||||
|
'type' => 'AGENCY'
|
||||||
|
]);
|
||||||
|
$company = Company::create($request->only('name', 'email', 'inn', 'legal_address', 'secret', 'status', 'type'));
|
||||||
if ($company) {
|
if ($company) {
|
||||||
return view('company.create');
|
$companyConfirmByBitrix = new SendCompany($company);
|
||||||
|
$companyConfirmByBitrix->send();
|
||||||
|
return view('company.created');
|
||||||
} else {
|
} else {
|
||||||
return back()->withInputs();
|
return back()->withInputs();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,12 +5,23 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company\Company;
|
||||||
use App\Models\Company\Details;
|
use App\Models\Company\Details;
|
||||||
|
use App\Models\Agent;
|
||||||
|
|
||||||
class DetailsController extends Controller
|
class DetailsController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Company $company) {
|
public function index() {
|
||||||
|
$company = false;
|
||||||
|
$userId = auth()->user()->id;
|
||||||
|
$agent = Agent::where('user_id', $userId)->get();
|
||||||
|
if ($agent->count() == 1) {
|
||||||
|
$agent = $agent->first();
|
||||||
|
$company = Company::find($agent->company_id);
|
||||||
|
} else {
|
||||||
|
return back();
|
||||||
|
};
|
||||||
|
|
||||||
$details = new Details($company);
|
$details = new Details($company);
|
||||||
$details = $details->details;
|
$details = $details->details;
|
||||||
if ($company->type == 'SELFEMP') {
|
if ($company->type == 'SELFEMP') {
|
||||||
@ -27,6 +38,17 @@ public function index(Company $company) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
public function store(Request $request, Company $company) {
|
public function store(Request $request, Company $company) {
|
||||||
|
$userId = auth()->user()->id;
|
||||||
|
$agent = Agent::where('user_id', $userId)->get();
|
||||||
|
if ($agent->count() == 1) {
|
||||||
|
$agent = $agent->first();
|
||||||
|
if ($agent->company_id != $company->id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return back();
|
||||||
|
};
|
||||||
|
|
||||||
$company->details = $request->all();
|
$company->details = $request->all();
|
||||||
$company->save();
|
$company->save();
|
||||||
return to_route('company.details', [
|
return to_route('company.details', [
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
use App\Models\Complex;
|
use App\Models\Complex;
|
||||||
use App\Models\Status;
|
use App\Models\Status;
|
||||||
use App\Models\Agent;
|
use App\Models\Agent;
|
||||||
use App\Models\BitrixSender;
|
use App\Models\Bitrix\SendClient;
|
||||||
|
|
||||||
|
|
||||||
class CreateClientForm extends Component
|
class CreateClientForm extends Component
|
||||||
@ -123,7 +123,6 @@ public function save() {
|
|||||||
public function sendToBitrix($id) {
|
public function sendToBitrix($id) {
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$agent = Agent::where('user_id', $user->id)->first();
|
$agent = Agent::where('user_id', $user->id)->first();
|
||||||
//dd($agent->user->name);
|
|
||||||
$agentName = $agent->user->getPartialsName();
|
$agentName = $agent->user->getPartialsName();
|
||||||
$data = [
|
$data = [
|
||||||
'CLIENT_FIRST_NAME' => $this->client['firstName'],
|
'CLIENT_FIRST_NAME' => $this->client['firstName'],
|
||||||
@ -136,7 +135,7 @@ public function sendToBitrix($id) {
|
|||||||
'OBJECT_NAME' => Complex::find($this->client['complexId'])->name,
|
'OBJECT_NAME' => Complex::find($this->client['complexId'])->name,
|
||||||
'CALLBACK_URL' => route('deal.confirm', ['hash' => $this->client['confirmToken']]),
|
'CALLBACK_URL' => route('deal.confirm', ['hash' => $this->client['confirmToken']]),
|
||||||
];
|
];
|
||||||
$sender = new BitrixSender($id, $data);
|
$sender = new SendClient($id, $data);
|
||||||
$response = $sender->send();
|
$response = $sender->send();
|
||||||
if ($response) {
|
if ($response) {
|
||||||
return $response;
|
return $response;
|
||||||
|
|||||||
48
app/Models/Bitrix/BitrixSender.php
Normal file
48
app/Models/Bitrix/BitrixSender.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Bitrix;
|
||||||
|
use App\Models\Company;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
class BitrixSender
|
||||||
|
{
|
||||||
|
public $url;
|
||||||
|
public $data;
|
||||||
|
public function __construct($url, $data) {
|
||||||
|
$this->url = $url;
|
||||||
|
$this->data = $data;
|
||||||
|
}
|
||||||
|
public function send() {
|
||||||
|
$postdata = http_build_query(
|
||||||
|
$this->data
|
||||||
|
);
|
||||||
|
$opts = array(
|
||||||
|
'ssl' => array(
|
||||||
|
'verify_peer' => false,
|
||||||
|
'verify_peername' => false
|
||||||
|
),
|
||||||
|
'http' => array(
|
||||||
|
'method' => 'POST',
|
||||||
|
'header' =>
|
||||||
|
'Content-type: application/x-www-form-urlencoded'."\r\n".
|
||||||
|
'',
|
||||||
|
'content' => $postdata
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$context = stream_context_create($opts);
|
||||||
|
$result = file_get_contents($this->url, false, $context);
|
||||||
|
$result = json_decode($result, $associative = true);
|
||||||
|
if (array_key_exists('result', $result)) {
|
||||||
|
return $result['result'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
dd($e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models\Bitrix;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
class BitrixSender
|
class SendClient
|
||||||
{
|
{
|
||||||
private $IBLOCK_TYPE_ID = 'lists';
|
private $IBLOCK_TYPE_ID = 'lists';
|
||||||
|
|
||||||
@ -21,20 +21,6 @@ class BitrixSender
|
|||||||
const BROKER_PHONE = "PROPERTY_99";
|
const BROKER_PHONE = "PROPERTY_99";
|
||||||
const OBJECT_NAME = "PROPERTY_100";
|
const OBJECT_NAME = "PROPERTY_100";
|
||||||
const CALLBACK_URL = "PROPERTY_105";
|
const CALLBACK_URL = "PROPERTY_105";
|
||||||
|
|
||||||
//CONFIG для VSSDOM
|
|
||||||
/*
|
|
||||||
private $URL = 'https://crm.vssdom.ru/rest/8802/diju1sn3w7rbuhmm/lists.element.add.json';
|
|
||||||
private $IBLOCK_ID = 52;
|
|
||||||
const CLIENT_SECOND_NAME = "PROPERTY_118";
|
|
||||||
const CLIENT_FIRST_NAME = "PROPERTY_119";
|
|
||||||
const CLIENT_PHONE = "PROPERTY_120";
|
|
||||||
const BROKER_SECOND_NAME = "PROPERTY_121";
|
|
||||||
const BROKER_FIRST_NAME = "PROPERTY_122";
|
|
||||||
const BROKER_PHONE = "PROPERTY_123";
|
|
||||||
const OBJECT_NAME = "PROPERTY_124";
|
|
||||||
const CALLBACK_URL = "PROPERTY_128";
|
|
||||||
*/
|
|
||||||
private $data = [];
|
private $data = [];
|
||||||
|
|
||||||
public function __construct($id, $data) {
|
public function __construct($id, $data) {
|
||||||
64
app/Models/Bitrix/SendCompany.php
Normal file
64
app/Models/Bitrix/SendCompany.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Bitrix;
|
||||||
|
use App\Models\Company\Company;
|
||||||
|
use App\Models\Bitrix\BitrixSender;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
class SendCompany
|
||||||
|
{
|
||||||
|
private $IBLOCK_TYPE_ID = 'rest_entity';
|
||||||
|
|
||||||
|
//CONFIG для Альфы
|
||||||
|
|
||||||
|
private $URL = 'https://b24alfa.pro/rest/3165/v90a792nderzu0dj/lists.element.add.json';
|
||||||
|
private $IBLOCK_ID = 24;
|
||||||
|
private $ID;
|
||||||
|
const NAME = "NAME";
|
||||||
|
const INN = "PROPERTY_118";
|
||||||
|
const PHONE = "PROPERTY_121";
|
||||||
|
const EMAIL = "PROPERTY_120";
|
||||||
|
const LEGAL_ADDRESS = "PROPERTY_119";
|
||||||
|
const CALLBACK_URL = "PROPERTY_122";
|
||||||
|
private $data = [];
|
||||||
|
|
||||||
|
public function __construct(Company $company) {
|
||||||
|
$this->ID = $company->id;
|
||||||
|
$data = array_change_key_case($company->attributesToArray(), CASE_UPPER);
|
||||||
|
$finalData = $this->castConstants($data);
|
||||||
|
$finalData[self::CALLBACK_URL] = route('company.status.update', [
|
||||||
|
'company' => $this->ID
|
||||||
|
]);
|
||||||
|
$this->data = $finalData;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function castConstants($data) {
|
||||||
|
$finalData = [];
|
||||||
|
$refl = new \ReflectionClass(__CLASS__);
|
||||||
|
$constants = $refl->getConstants();
|
||||||
|
foreach ( $constants as $constName => $constValue )
|
||||||
|
{
|
||||||
|
foreach ($data as $key => $value)
|
||||||
|
{
|
||||||
|
if ( $constName == $key ) {
|
||||||
|
$finalData[$constValue] = $value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $finalData;
|
||||||
|
}
|
||||||
|
public function send() {
|
||||||
|
$data = [
|
||||||
|
'IBLOCK_TYPE_ID' => $this->IBLOCK_TYPE_ID,
|
||||||
|
'IBLOCK_ID' => $this->IBLOCK_ID,
|
||||||
|
'ELEMENT_CODE' => $this->ID,
|
||||||
|
'FIELDS' => $this->data,
|
||||||
|
'PROPERTY_VALUES' => $this->data
|
||||||
|
];
|
||||||
|
$sender = new BitrixSender($this->URL, $data);
|
||||||
|
$sender->send();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models\Company;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@ -9,6 +9,9 @@ class Company extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
const STATUS_NEW = 'new';
|
||||||
|
const STATUS_ACCEPTED = 'accepted';
|
||||||
|
const STATUS_DECLINED = 'declined';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'type',
|
'type',
|
||||||
'name',
|
'name',
|
||||||
@ -17,7 +20,9 @@ class Company extends Model
|
|||||||
'email',
|
'email',
|
||||||
'address',
|
'address',
|
||||||
'legal_address',
|
'legal_address',
|
||||||
'details'
|
'details',
|
||||||
|
'status',
|
||||||
|
'secret'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -8,6 +8,9 @@
|
|||||||
class CompanyAdmin extends Model
|
class CompanyAdmin extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'company_id'
|
||||||
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable implements MustVerifyEmail
|
||||||
{
|
{
|
||||||
use HasApiTokens, HasFactory, Notifiable;
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
|
|||||||
2
composer.lock
generated
2
composer.lock
generated
@ -8558,4 +8558,4 @@
|
|||||||
},
|
},
|
||||||
"platform-dev": {},
|
"platform-dev": {},
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
|
$table->enum('status', ['new', 'accepted', 'declined']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
|
$table->string('secret');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
@ -1397,4 +1397,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
public/images/LabRes-20241120053708844406.pdf
Normal file
BIN
public/images/LabRes-20241120053708844406.pdf
Normal file
Binary file not shown.
43
resources/views/company/agents/table.blade.php
Normal file
43
resources/views/company/agents/table.blade.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div>
|
||||||
|
<form class="d-flex mb-3" method="GET" action="{{ route('clients.table') }}">
|
||||||
|
<div class="p-2 border rounded-3 border-1 p-1 bg-white">
|
||||||
|
<input type="radio" class="btn-check" name="status" value="all" id="option5" autocomplete="off"
|
||||||
|
onclick="this.form.submit()" {{ $status == 'all' ? 'checked' : '' }}>
|
||||||
|
<label class="btn p-2 fs-5" for="option5">Все</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="status" value="unique" id="option6" autocomplete="off"
|
||||||
|
onclick="this.form.submit()" {{ $status == 'unique' ? 'checked' : '' }}>
|
||||||
|
<label class="btn p-2 fs-5" for="option6">Уникальные</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="status" value="not unique" id="option7" autocomplete="off"
|
||||||
|
onclick="this.form.submit()" {{ $status == 'not unique' ? 'checked' : '' }}>
|
||||||
|
<label class="btn p-2 fs-5" for="option7">Не
|
||||||
|
уникальные</label>
|
||||||
|
</div>
|
||||||
|
<div class="ms-auto p-2">
|
||||||
|
<select class="form-select form-select-lg" aria-label="Large select example">
|
||||||
|
<option selected="">Город: любой</option>
|
||||||
|
@foreach ($cities as $city)
|
||||||
|
<option selected="">{{ $city->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
@if (!$status || $status == 'all' || $status == 'unique')
|
||||||
|
<h4 class="fw-bold mt-5 mb-3">Уникальные</h4>
|
||||||
|
<div class="fs-5 bg-light mb-2">
|
||||||
|
@livewire('clientsTable', ['status' => 'UNIQUE'])
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if (!$status || $status == 'all' || $status == 'not unique')
|
||||||
|
<h4 class="fw-bold mt-5 mb-3">Не уникальные</h4>
|
||||||
|
<div class="fs-5 bg-light mb-2">
|
||||||
|
@livewire('clientsTable', ['status' => 'NOT UNIQUE'])
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@ -1,27 +1,39 @@
|
|||||||
@extends('layouts.guest')
|
@extends('layouts.guest')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<form action="{{ route('company.create') }}" method="post">
|
<div class="container">
|
||||||
@csrf
|
<div class="row justify-content-center">
|
||||||
<div class="mb-3">
|
<div class="col-md-8">
|
||||||
<label for="companyName" class="form-label">Название компании</label>
|
<div class="card">
|
||||||
<input type="text" class="form-control" id="companyName" name="name">
|
<div class="card-header">{{ __('Create company form') }}</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="card-body">
|
||||||
<label for="companyInn" class="form-label">ИНН</label>
|
<form action="{{ route('company.create') }}" method="post">
|
||||||
<input type="text" class="form-control" id="companyInn" name="inn">
|
@csrf
|
||||||
</div>
|
<div class="mb-3">
|
||||||
|
<label for="companyName" class="form-label">Название компании</label>
|
||||||
|
<input type="text" class="form-control" id="companyName" name="name">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="companyEmail" class="form-label">Электронная почта</label>
|
<label for="companyInn" class="form-label">ИНН</label>
|
||||||
<input type="text" class="form-control" id="companyEmail" name="email">
|
<input type="text" class="form-control" id="companyInn" name="inn">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
|
||||||
<label for="companyLegalAddress" class="form-label">Юридический адрес</label>
|
|
||||||
<input type="text" class="form-control" id="companyLegalAddress" name="legal_address">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary" name="Отправить заявку">
|
<div class="mb-3">
|
||||||
</form>
|
<label for="companyEmail" class="form-label">Электронная почта</label>
|
||||||
|
<input type="text" class="form-control" id="companyEmail" name="email">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="companyLegalAddress" class="form-label">Юридический адрес</label>
|
||||||
|
<input type="text" class="form-control" id="companyLegalAddress" name="legal_address">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="submit" class="btn btn-primary" name="Отправить заявку">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
10
resources/views/company/created.blade.php
Normal file
10
resources/views/company/created.blade.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@extends('layouts.guest')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
Отлично! Мы направили Вашу заявку на модерацию. Как только заявка на подключение будет обработана, мы направим
|
||||||
|
Вам на электронную почту дальнейшие инструкции!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
31
resources/views/company/post_confirmer.blade.php
Normal file
31
resources/views/company/post_confirmer.blade.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
@extends('layouts.guest')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<form action="{{ route('company.status.update') }}" method="post">
|
||||||
|
<p>
|
||||||
|
company_id:<br>
|
||||||
|
<input type="text" name="company_id">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
secret:<br>
|
||||||
|
<input type="text" name="secret">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
status:<br>
|
||||||
|
<input type="text" name="status">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
user_name:<br>
|
||||||
|
<input type="text" name="user_name">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
user_phone:<br>
|
||||||
|
<input type="text" name="user_phone">
|
||||||
|
</p>
|
||||||
|
<button type="submit">Send</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@ -21,33 +21,23 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
@vite(['resources/sass/app.scss', 'resources/js/app.js', 'resources/css/app.css'])
|
@vite(['resources/sass/app.scss', 'resources/js/app.js', 'resources/css/app.css'])
|
||||||
|
<style>
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
height: 100% !important
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body class="d-flex align-items-center py-4 bg-body-tertiary">
|
||||||
<div class="container text-center">
|
<div class="container">
|
||||||
<nav class="navbar bg-body-tertiary">
|
<div class="row justify-content-center">
|
||||||
<div class="container-fluid">
|
<div class="col-md-8 text-center">
|
||||||
<a class="navbar-brand">
|
<img src={{ url('/images/logo.png') }} alt="Alfa logo" width="70">
|
||||||
<img src={{ url('/images/logo.png') }} alt="Bootstrap" width="70">
|
|
||||||
</a>
|
|
||||||
<li class="nav-item dropdown d-flex">
|
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
|
|
||||||
aria-expanded="false">
|
|
||||||
<i class="bi bi-person" style="font-size: 1.5rem"></i>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a class="dropdown-item" href="{{ route('login') }}">Войти</a></li>
|
|
||||||
<li><a class="dropdown-item" href="{{ route('register') }}">Зарегистрироваться</a></li>
|
|
||||||
<li><a class="dropdown-item" href="{{ route('company.form.create') }}">Создать компанию</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
|
||||||
<div class="">
|
|
||||||
@yield('content')
|
|
||||||
</div>
|
</div>
|
||||||
|
@yield('content')
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -12,13 +12,13 @@ class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" ar
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item text-center m-2">
|
<li class="nav-item text-center m-2">
|
||||||
<a href="{{ route('clients.table') }}"
|
<a href="{{ route('agents.table') }}"
|
||||||
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" aria-current="page">
|
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" aria-current="page">
|
||||||
<i class="bi bi-people"></i> Агенты
|
<i class="bi bi-people"></i> Агенты
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item text-center m-2">
|
<li class="nav-item text-center m-2">
|
||||||
<a href="{{ route('company.details', ['company' => 1]) }}"
|
<a href="{{ route('company.details') }}"
|
||||||
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" aria-current="page">
|
class="nav-link d-flex align-items-center gap-2 fs-5 border rounded-4 active" aria-current="page">
|
||||||
<i class="bi bi-gear"></i> Настройки
|
<i class="bi bi-gear"></i> Настройки
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
@extends('layouts.guest')
|
@extends('layouts.guest')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<main class="form-signin w-100 m-auto" style="max-width: 330px;">
|
||||||
<div class="col">
|
|
||||||
<a href="" class="btn btn-primary">Создать организацию</a>
|
<a class="btn btn-primary w-100 py-2 mb-2" href="{{ route('login') }}">Войти</a>
|
||||||
</div>
|
<a class="btn btn-secondary w-100 py-2 mb-2" href="{{ route('register') }}">Зарегистрироваться</a>
|
||||||
<div class="col">
|
<a class="btn btn-secondary w-100 py-2 mb-2" href="{{ route('company.form.create') }}">Создать компанию</a>
|
||||||
<a href="" class="btn btn-primary">Войти!</a>
|
</main>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
use App\Http\Controllers\ConfirmClientFromBitrix;
|
use App\Http\Controllers\ConfirmClientFromBitrix;
|
||||||
|
use App\Http\Controllers\Company\ConfirmCompanyController;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -22,3 +22,4 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
Route::post('/client/confirm', [ConfirmClientFromBitrix::class, 'confirm'])->name('deal.confirm');
|
Route::post('/client/confirm', [ConfirmClientFromBitrix::class, 'confirm'])->name('deal.confirm');
|
||||||
|
Route::post('/company/status/update', ConfirmCompanyController::class)->name('company.status.update');
|
||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
|
||||||
use App\Http\Controllers\Company\CreateCompanyController;
|
use App\Http\Controllers\Company\CreateCompanyController;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -19,19 +21,27 @@
|
|||||||
return view(view: 'welcome');
|
return view(view: 'welcome');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Auth::routes();
|
||||||
|
Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
|
||||||
|
$request->fulfill();
|
||||||
|
|
||||||
|
return redirect('/home');
|
||||||
|
})->middleware(['auth', 'signed'])->name('verification.verify');
|
||||||
|
|
||||||
//Company
|
//Company
|
||||||
Route::get('/company/create', function () {
|
Route::get('/company/create', function () {
|
||||||
return view(view: 'company.create');
|
return view(view: 'company.create');
|
||||||
})->name('company.form.create');
|
})->name('company.form.create');
|
||||||
|
|
||||||
Route::post('/company/create', CreateCompanyController::class)->name('company.create');
|
Route::get('/company/confirmer', function ()
|
||||||
|
{
|
||||||
|
return view(view: 'company.post_confirmer');
|
||||||
|
});
|
||||||
|
|
||||||
Auth::routes();
|
Route::post('/company/create', CreateCompanyController::class)->name('company.create');
|
||||||
|
|
||||||
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
|
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
|
||||||
Route::get('/clients/table', [App\Http\Controllers\ClientsTableController::class, 'index'])->name('clients.table');
|
Route::get('/clients/table', [App\Http\Controllers\ClientsTableController::class, 'index'])->name('clients.table');
|
||||||
Route::get('/company/{company}/details/', [App\Http\Controllers\Company\DetailsController::class, 'index'])->name('company.details');
|
Route::get('/company/details/', [App\Http\Controllers\Company\DetailsController::class, 'index'])->name('company.details');
|
||||||
Route::post('/company/{company}/details/', [App\Http\Controllers\Company\DetailsController::class, 'store'])->name('company.details.store');
|
Route::post('/company/{company}/details/', [App\Http\Controllers\Company\DetailsController::class, 'store'])->name('company.details.store');
|
||||||
|
Route::get('/agents/table', [App\Http\Controllers\Company\AgentsTableController::class, 'index'])->name('agents.table');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user