diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 49ae99d..b1060a8 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -4,7 +4,7 @@ use App\Http\Controllers\Controller; use App\Models\User; -use App\Models\Agent; +use App\Models\Agent\Agent; use App\Models\Company\Company; use Illuminate\Foundation\Auth\RegistersUsers; @@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Validator; class RegisterController extends Controller -{ + { /* |-------------------------------------------------------------------------- | Register Controller @@ -39,9 +39,9 @@ class RegisterController extends Controller * @return void */ public function __construct() - { + { $this->middleware('guest'); - } + } /** * Get a validator for an incoming registration request. @@ -50,7 +50,7 @@ public function __construct() * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) - { + { return Validator::make($data, [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], @@ -58,7 +58,7 @@ protected function validator(array $data) 'password' => ['required', 'string', 'min:8', 'confirmed'], 'inn' => ['required', 'unique:companies'] ]); - } + } /** * Create a new user instance after a valid registration. @@ -67,8 +67,8 @@ protected function validator(array $data) * @return \App\Models\User */ protected function create(array $data) - { - $user = User::create([ + { + $user = User::create([ 'name' => $data['name'], 'email' => $data['email'], 'phone' => $data['phone'], @@ -88,7 +88,7 @@ protected function create(array $data) 'user_id' => $user->id, 'company_id' => $company->id ]); - + return $user; + } } -} diff --git a/app/Http/Controllers/ClientsTableController.php b/app/Http/Controllers/ClientsTableController.php index 894fe85..5a17de1 100644 --- a/app/Http/Controllers/ClientsTableController.php +++ b/app/Http/Controllers/ClientsTableController.php @@ -5,20 +5,22 @@ use Illuminate\Http\Request; use App\Models\Deal; -use App\Models\Agent; +use App\Models\Agent\Agent; use App\Models\City; class ClientsTableController extends Controller -{ - public function index(Request $request) { + { + public function index(Request $request) + { $user = auth()->user(); $agent = Agent::where('user_id', $user->id)->first(); return view( - 'clients.table', [ - 'deals' => $agent->deals, - 'status' => $request->status, - 'cities' => City::all() + 'clients.table', + [ + 'deals' => $agent->deals, + 'status' => $request->status, + 'cities' => City::all() ] ); + } } -} diff --git a/app/Http/Controllers/Company/AgentsTableController.php b/app/Http/Controllers/Company/AgentsTableController.php index e5b0053..dedf3d5 100644 --- a/app/Http/Controllers/Company/AgentsTableController.php +++ b/app/Http/Controllers/Company/AgentsTableController.php @@ -4,21 +4,40 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; -use App\Models\Agent; +use App\Models\Agent\Agent; +use App\Models\Agent\AgentStatus; use App\Models\Company\CompanyAdmin; +use App\Models\City; + class AgentsTableController extends Controller -{ - public function index() { + { + public function index(Request $request) + { $user = auth()->user(); $admin = CompanyAdmin::where('user_id', $user->id); - if ($admin->count()) { + if ($admin->count()) + { $admin = $admin->first(); + $agents = Agent::where('company_id', $admin->company_id); + switch ( $request->status ) + { + case AgentStatus::DISMISSED: + $agents->whereNotNull('deleted_at'); + break; + default: + $agents->withTrashed(); + } + return view('company.agents.table', [ - 'agents' => Agent::where('company_id', $admin->company_id)->get() - ]); - } else { + 'agents' => $agents->get(), + 'status' => $request->status, + 'cities' => City::all() + ])->with('statuses', AgentStatus::class); + } + else + { echo 'has no permissions'; return; + } } } -} diff --git a/app/Http/Controllers/Company/ConfirmCompanyController.php b/app/Http/Controllers/Company/ConfirmCompanyController.php index 48fe3c3..03863a1 100644 --- a/app/Http/Controllers/Company/ConfirmCompanyController.php +++ b/app/Http/Controllers/Company/ConfirmCompanyController.php @@ -4,35 +4,42 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; -use Illuminate\Auth\Events\Registered; +use Illuminate\Foundation\Auth\RegistersUsers; use App\Models\Company\Company; use App\Models\Company\CompanyAdmin; use App\Models\User; class ConfirmCompanyController extends Controller -{ - public function __invoke(Request $request) { + use RegistersUsers; + public function __invoke(Request $request) + { $company = Company::find($request->company_id); - if ($company->secret == $request->secret) { + if ($company->secret == $request->secret) + { $company->status = $request->status; $company->save(); $user = User::where('email', $company->email); - if ($user->count() == 1) { + if ($user->count() == 1) + { $user = $user->first(); - } else { + } + 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 ]); - }; - } -} + return true; + } + return false; + } + } \ No newline at end of file diff --git a/app/Livewire/AgentsTable.php b/app/Livewire/AgentsTable.php new file mode 100644 index 0000000..6f0c230 --- /dev/null +++ b/app/Livewire/AgentsTable.php @@ -0,0 +1,39 @@ +status = $status; + } + public function render() + { + $user = auth()->user(); + $admin = CompanyAdmin::where('user_id', $user->id)->first(); + $agents = Agent::where('company_id', $admin->company_id); + if ($this->status == AgentStatus::DISMISSED) + { + $agents->whereNotNull('deleted_at'); + } + return view( + 'livewire.agents-table', + [ + 'agents' => $agents->paginate(10) + ] + ); + } + } diff --git a/app/Livewire/ClientsTable.php b/app/Livewire/ClientsTable.php index 8c5dcfd..93a33db 100644 --- a/app/Livewire/ClientsTable.php +++ b/app/Livewire/ClientsTable.php @@ -6,32 +6,38 @@ use Livewire\WithPagination; use Livewire\WithoutUrlPagination; -use App\Models\Agent; +use App\Models\Agent\Agent; use App\Models\Deal; class ClientsTable extends Component -{ + { use WithPagination; public $status; - public function mount($status = null) { + public function mount($status = null) + { $this->status = $status; - } + } public function render() - { + { $user = auth()->user(); $agent = Agent::where('user_id', $user->id)->first(); $deals = []; - if ($this->status && $this->status=='UNIQUE') { + if ($this->status && $this->status == 'UNIQUE') + { $deals = Deal::where('agent_id', $agent->id)->where('status', $this->status)->paginate(8); - } else { + } + else + { $deals = Deal::where('agent_id', $agent->id)->paginate(8); - }; + } + ; return view( - 'livewire.clients-table', [ - 'deals' => $deals + 'livewire.clients-table', + [ + 'deals' => $deals ] ); + } } -} diff --git a/app/Livewire/CreateClientForm.php b/app/Livewire/CreateClientForm.php index a3d1127..6454300 100644 --- a/app/Livewire/CreateClientForm.php +++ b/app/Livewire/CreateClientForm.php @@ -7,12 +7,12 @@ use App\Models\Deal; use App\Models\Complex; use App\Models\Status; -use App\Models\Agent; +use App\Models\Agent\Agent; use App\Models\Bitrix\SendClient; class CreateClientForm extends Component -{ + { const NEW = 1; const ERROR = 2; const SUCCESS = 3; @@ -28,14 +28,16 @@ class CreateClientForm extends Component 'client.phone.regex' => 'Телефон должен содержать 10 симвлов без указания кода страны "+7" или "8"', 'client.phone.unique' => 'Клиент с таким телефоном уже существует' ]; - protected function rules() { + protected function rules() + { return [ 'client.firstName' => ['required', 'string', 'max:255'], 'client.secondName' => ['required', 'string', 'max:255'], 'client.phone' => ['required', 'string', 'regex:/\(?([0-9]{3})\)([-]{1})([0-9]{3})([-]{1})([0-9]{4})/i'] ]; - } - public function mount() { + } + public function mount() + { $userBroker = Agent::where('user_id', auth()->user()->id)->first(); $this->complexes = Complex::all(); $this->client = [ @@ -45,82 +47,104 @@ public function mount() { 'complexId' => '' ]; $this->status = self::NEW; - } - public function update() { - } + } + public function update() + { + } public function updated($propertyName) - { + { $this->status = self::NEW; - if ($propertyName == 'client.phone') { + if ($propertyName == 'client.phone') + { $phone = preg_replace('/[^0-9]/', "", $this->client['phone']); if (strlen($phone) == 10) - { + { $sArea = substr($phone, 0, 3); $sPrefix = substr($phone, 3, 3); $sNumber = substr($phone, 6, 4); $phone = "(" . $sArea . ")-" . $sPrefix . "-" . $sNumber; $this->client['phone'] = $phone; - } elseif (strlen($this->client['phone']) == 1) { - if ($this->client['phone'] == "8" || $this->client['phone'] == "7" || $this->client['phone'] == "+") { - $this->client['phone'] = null; - } else { - $this->client['phone'] = $phone; } - } else { + elseif (strlen($this->client['phone']) == 1) + { + if ($this->client['phone'] == "8" || $this->client['phone'] == "7" || $this->client['phone'] == "+") + { + $this->client['phone'] = null; + } + else + { + $this->client['phone'] = $phone; + } + } + else + { $this->client['phone'] = $phone; + } } - } $this->validateOnly($propertyName); - } + } public function render() - { - if ($this->client['firstName'] + { + if ( + $this->client['firstName'] && $this->client['secondName'] && $this->client['phone'] && $this->client['complexId'] && $this->status == self::NEW - ) { + ) + { $this->status = self::READY; - } + } return view('livewire.create-client-form'); - } - public function resetData() { + } + public function resetData() + { $this->mount(); - } - public function back() { + } + public function back() + { $this->status = self::NEW; - } - public function save() { + } + public function save() + { $validated = $this->validate($this->rules()); $agent = Agent::where('user_id', auth()->user()->id)->first(); $phone = '+7' . $this->client['phone']; $newUser = User::updateOrCreate( ['phone' => $phone], [ - 'name' => trim($this->client['firstName'] . ' ' . $this->client['secondName']) - , 'phone' => $phone - ]); + 'name' => trim($this->client['firstName'] . ' ' . $this->client['secondName']), + 'phone' => $phone + ] + ); $data = [ 'agent_id' => $agent->id - , 'client_id' => $newUser->id - , 'complex_id' => $this->client['complexId'] + , + 'client_id' => $newUser->id + , + 'complex_id' => $this->client['complexId'] ]; $data['confirm_token'] = $this->client['confirmToken'] = hash('sha256', json_encode($data)); - if ($newDeal = Deal::create($data)) { - if ($bitrixId = $this->sendToBitrix($newDeal->id)) { + if ($newDeal = Deal::create($data)) + { + if ($bitrixId = $this->sendToBitrix($newDeal->id)) + { $newDeal->bitrix_id = $bitrixId; $newDeal->status = 'MODERATION'; $newDeal->save(); $this->result = $bitrixId; return $this->status = self::SUCCESS; - } else { + } + else + { $newDeal->delete(); + } } - } return $this->status = self::ERROR; - } - public function sendToBitrix($id) { + } + public function sendToBitrix($id) + { $user = auth()->user(); $agent = Agent::where('user_id', $user->id)->first(); $agentName = $agent->user->getPartialsName(); @@ -137,10 +161,13 @@ public function sendToBitrix($id) { ]; $sender = new SendClient($id, $data); $response = $sender->send(); - if ($response) { + if ($response) + { return $response; - } else { + } + else + { return false; + } } - } -} \ No newline at end of file + } \ No newline at end of file diff --git a/app/Models/Agent.php b/app/Models/Agent/Agent.php similarity index 52% rename from app/Models/Agent.php rename to app/Models/Agent/Agent.php index 2cc72ed..1af8364 100644 --- a/app/Models/Agent.php +++ b/app/Models/Agent/Agent.php @@ -1,29 +1,37 @@ belongsTo(Company::class); - } - public function user() { + } + public function user() + { return $this->belongsTo(User::class); - } + } - public function deals() { + public function deals() + { return $this->hasMany(Deal::class); + } } -} diff --git a/app/Models/Agent/AgentStatus.php b/app/Models/Agent/AgentStatus.php new file mode 100644 index 0000000..7284c77 --- /dev/null +++ b/app/Models/Agent/AgentStatus.php @@ -0,0 +1,7 @@ +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 + 'company' => $this->ID, + 'secret' => $company->secret ]); $this->data = $finalData; return; - } + } - private function castConstants($data) { + private function castConstants($data) + { $finalData = []; $refl = new \ReflectionClass(__CLASS__); $constants = $refl->getConstants(); - foreach ( $constants as $constName => $constValue ) - { - foreach ($data as $key => $value) + foreach ($constants as $constName => $constValue) { - if ( $constName == $key ) { + foreach ($data as $key => $value) + { + if ($constName == $key) + { $finalData[$constValue] = $value; break; + } } } - } return $finalData; - } - public function send() { + } + 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 + '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(); + } } -} diff --git a/config/app.php b/config/app.php index f32048a..32dde96 100644 --- a/config/app.php +++ b/config/app.php @@ -83,7 +83,7 @@ | */ - 'locale' => 'en', + 'locale' => 'ru', /* |-------------------------------------------------------------------------- diff --git a/config/mail.php b/config/mail.php index e894b2e..b109219 100644 --- a/config/mail.php +++ b/config/mail.php @@ -36,7 +36,7 @@ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', - 'url' => env('MAIL_URL'), + //'url' => env('MAIL_URL'), 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), diff --git a/lang/en/auth.php b/lang/en/auth.php new file mode 100644 index 0000000..6598e2c --- /dev/null +++ b/lang/en/auth.php @@ -0,0 +1,20 @@ + 'These credentials do not match our records.', + 'password' => 'The provided password is incorrect.', + 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/lang/en/pagination.php b/lang/en/pagination.php new file mode 100644 index 0000000..d481411 --- /dev/null +++ b/lang/en/pagination.php @@ -0,0 +1,19 @@ + '« Previous', + 'next' => 'Next »', + +]; diff --git a/lang/en/passwords.php b/lang/en/passwords.php new file mode 100644 index 0000000..f1223bd --- /dev/null +++ b/lang/en/passwords.php @@ -0,0 +1,22 @@ + 'Your password has been reset.', + 'sent' => 'We have emailed your password reset link.', + 'throttled' => 'Please wait before retrying.', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that email address.", + +]; diff --git a/lang/en/validation.php b/lang/en/validation.php new file mode 100644 index 0000000..8dbe37f --- /dev/null +++ b/lang/en/validation.php @@ -0,0 +1,191 @@ + 'The :attribute field must be accepted.', + 'accepted_if' => 'The :attribute field must be accepted when :other is :value.', + 'active_url' => 'The :attribute field must be a valid URL.', + 'after' => 'The :attribute field must be a date after :date.', + 'after_or_equal' => 'The :attribute field must be a date after or equal to :date.', + 'alpha' => 'The :attribute field must only contain letters.', + 'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.', + 'alpha_num' => 'The :attribute field must only contain letters and numbers.', + 'array' => 'The :attribute field must be an array.', + 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', + 'before' => 'The :attribute field must be a date before :date.', + 'before_or_equal' => 'The :attribute field must be a date before or equal to :date.', + 'between' => [ + 'array' => 'The :attribute field must have between :min and :max items.', + 'file' => 'The :attribute field must be between :min and :max kilobytes.', + 'numeric' => 'The :attribute field must be between :min and :max.', + 'string' => 'The :attribute field must be between :min and :max characters.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'can' => 'The :attribute field contains an unauthorized value.', + 'confirmed' => 'The :attribute field confirmation does not match.', + 'current_password' => 'The password is incorrect.', + 'date' => 'The :attribute field must be a valid date.', + 'date_equals' => 'The :attribute field must be a date equal to :date.', + 'date_format' => 'The :attribute field must match the format :format.', + 'decimal' => 'The :attribute field must have :decimal decimal places.', + 'declined' => 'The :attribute field must be declined.', + 'declined_if' => 'The :attribute field must be declined when :other is :value.', + 'different' => 'The :attribute field and :other must be different.', + 'digits' => 'The :attribute field must be :digits digits.', + 'digits_between' => 'The :attribute field must be between :min and :max digits.', + 'dimensions' => 'The :attribute field has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', + 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', + 'email' => 'The :attribute field must be a valid email address.', + 'ends_with' => 'The :attribute field must end with one of the following: :values.', + 'enum' => 'The selected :attribute is invalid.', + 'exists' => 'The selected :attribute is invalid.', + 'extensions' => 'The :attribute field must have one of the following extensions: :values.', + 'file' => 'The :attribute field must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'array' => 'The :attribute field must have more than :value items.', + 'file' => 'The :attribute field must be greater than :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than :value.', + 'string' => 'The :attribute field must be greater than :value characters.', + ], + 'gte' => [ + 'array' => 'The :attribute field must have :value items or more.', + 'file' => 'The :attribute field must be greater than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than or equal to :value.', + 'string' => 'The :attribute field must be greater than or equal to :value characters.', + ], + 'hex_color' => 'The :attribute field must be a valid hexadecimal color.', + 'image' => 'The :attribute field must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field must exist in :other.', + 'integer' => 'The :attribute field must be an integer.', + 'ip' => 'The :attribute field must be a valid IP address.', + 'ipv4' => 'The :attribute field must be a valid IPv4 address.', + 'ipv6' => 'The :attribute field must be a valid IPv6 address.', + 'json' => 'The :attribute field must be a valid JSON string.', + 'lowercase' => 'The :attribute field must be lowercase.', + 'lt' => [ + 'array' => 'The :attribute field must have less than :value items.', + 'file' => 'The :attribute field must be less than :value kilobytes.', + 'numeric' => 'The :attribute field must be less than :value.', + 'string' => 'The :attribute field must be less than :value characters.', + ], + 'lte' => [ + 'array' => 'The :attribute field must not have more than :value items.', + 'file' => 'The :attribute field must be less than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be less than or equal to :value.', + 'string' => 'The :attribute field must be less than or equal to :value characters.', + ], + 'mac_address' => 'The :attribute field must be a valid MAC address.', + 'max' => [ + 'array' => 'The :attribute field must not have more than :max items.', + 'file' => 'The :attribute field must not be greater than :max kilobytes.', + 'numeric' => 'The :attribute field must not be greater than :max.', + 'string' => 'The :attribute field must not be greater than :max characters.', + ], + 'max_digits' => 'The :attribute field must not have more than :max digits.', + 'mimes' => 'The :attribute field must be a file of type: :values.', + 'mimetypes' => 'The :attribute field must be a file of type: :values.', + 'min' => [ + 'array' => 'The :attribute field must have at least :min items.', + 'file' => 'The :attribute field must be at least :min kilobytes.', + 'numeric' => 'The :attribute field must be at least :min.', + 'string' => 'The :attribute field must be at least :min characters.', + ], + 'min_digits' => 'The :attribute field must have at least :min digits.', + 'missing' => 'The :attribute field must be missing.', + 'missing_if' => 'The :attribute field must be missing when :other is :value.', + 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', + 'missing_with' => 'The :attribute field must be missing when :values is present.', + 'missing_with_all' => 'The :attribute field must be missing when :values are present.', + 'multiple_of' => 'The :attribute field must be a multiple of :value.', + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute field format is invalid.', + 'numeric' => 'The :attribute field must be a number.', + 'password' => [ + 'letters' => 'The :attribute field must contain at least one letter.', + 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.', + 'numbers' => 'The :attribute field must contain at least one number.', + 'symbols' => 'The :attribute field must contain at least one symbol.', + 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', + ], + 'present' => 'The :attribute field must be present.', + 'present_if' => 'The :attribute field must be present when :other is :value.', + 'present_unless' => 'The :attribute field must be present unless :other is :value.', + 'present_with' => 'The :attribute field must be present when :values is present.', + 'present_with_all' => 'The :attribute field must be present when :values are present.', + 'prohibited' => 'The :attribute field is prohibited.', + 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', + 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', + 'prohibits' => 'The :attribute field prohibits :other from being present.', + 'regex' => 'The :attribute field format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_array_keys' => 'The :attribute field must contain entries for: :values.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute field must match :other.', + 'size' => [ + 'array' => 'The :attribute field must contain :size items.', + 'file' => 'The :attribute field must be :size kilobytes.', + 'numeric' => 'The :attribute field must be :size.', + 'string' => 'The :attribute field must be :size characters.', + ], + 'starts_with' => 'The :attribute field must start with one of the following: :values.', + 'string' => 'The :attribute field must be a string.', + 'timezone' => 'The :attribute field must be a valid timezone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'uppercase' => 'The :attribute field must be uppercase.', + 'url' => 'The :attribute field must be a valid URL.', + 'ulid' => 'The :attribute field must be a valid ULID.', + 'uuid' => 'The :attribute field must be a valid UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [], + +]; diff --git a/lang/ru.json b/lang/ru.json new file mode 100644 index 0000000..f821498 --- /dev/null +++ b/lang/ru.json @@ -0,0 +1,3 @@ +{ + "Login": "Вход на сайт" +} \ No newline at end of file diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 84bb9d4..16f175a 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -5,15 +5,14 @@
-
{{ __('Login') }}
+
Форма входа
@csrf
- +
- - +
@@ -61,12 +58,12 @@ class="form-control @error('password') is-invalid @enderror" name="password"
@if (Route::has('password.request')) - {{ __('Forgot Your Password?') }} + Восстановить пароль @endif
diff --git a/resources/views/company/agents/table.blade.php b/resources/views/company/agents/table.blade.php index 40bf422..b6d7745 100644 --- a/resources/views/company/agents/table.blade.php +++ b/resources/views/company/agents/table.blade.php @@ -2,20 +2,19 @@ @section('content')
- +
+ onclick="this.form.submit()" {{ $status == 'all' || !$status ? 'checked' : '' }}> - - + + - - + +
- @if (!$status || $status == 'all' || $status == 'unique') -

Уникальные

+ @if (!$status || $status == 'all' || $status == $statuses::ACTIVE) +

Активные

- @livewire('clientsTable', ['status' => 'UNIQUE']) + @livewire('agentsTable', ['status' => $statuses::ACTIVE])
@endif - @if (!$status || $status == 'all' || $status == 'not unique') -

Не уникальные

+ @if (!$status || $status == 'all' || $status == $statuses::DISMISSED) +

Уволенные

- @livewire('clientsTable', ['status' => 'NOT UNIQUE']) + @livewire('agentsTable', ['status' => $statuses::DISMISSED])
@endif
diff --git a/resources/views/livewire/agents-table.blade.php b/resources/views/livewire/agents-table.blade.php new file mode 100644 index 0000000..a89168d --- /dev/null +++ b/resources/views/livewire/agents-table.blade.php @@ -0,0 +1,27 @@ +
+
+ + + @foreach ($agents as $agent) + + + + + + + @endforeach + +
+ + + {{ $agent->user->name }} + + {{ $agent->user->phone }} + + {{ $agent->user->email }} +
+
+
+ {{ $agents->links('layouts.pagination') }} +
+
diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 0a5c49e..bf84e7c 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -2,7 +2,6 @@ @section('content')
- Войти Зарегистрироваться Создать компанию diff --git a/routes/web.php b/routes/web.php index 7d08361..084e085 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,7 +3,7 @@ use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Auth\EmailVerificationRequest; - + use App\Http\Controllers\Company\CreateCompanyController; /* @@ -17,31 +17,34 @@ | */ -Route::get('/', function () { +Route::get('/', function () + { return view(view: 'welcome'); -}); + }); Auth::routes(); -Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) { +Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) + { $request->fulfill(); - return redirect('/home'); -})->middleware(['auth', 'signed'])->name('verification.verify'); + })->middleware(['auth', 'signed'])->name('verification.verify'); //Company -Route::get('/company/create', function () { +Route::get('/company/create', function () + { 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'); }); -Route::post('/company/create', CreateCompanyController::class)->name('company.create'); - -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('/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::get('/agents/table', [App\Http\Controllers\Company\AgentsTableController::class, 'index'])->name('agents.table'); +Route::middleware(['auth'])->group(function () + { + 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('/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::get('/agents/table', [App\Http\Controllers\Company\AgentsTableController::class, 'index'])->name('agents.table'); + }); \ No newline at end of file