%PDF- %PDF-
Direktori : /home/silvzytp/crm-ind-code/resources/views/backend/pages/agents/ |
Current File : //home/silvzytp/crm-ind-code/resources/views/backend/pages/agents/form.blade.php |
@extends('layouts.backend') @section('title', $siteTitle) @section('action') <button type="submit" class="btn btn-sm btn-success submit-form-btn"><i class="fa fa-floppy-o"></i> @isset($agent) Update @else Submit @endisset </button> @endsection @push('styles') @endpush @section('content') <div class="row"> <div class="col-12 col-md-8 mx-auto"> <form action="{{ isset($agent) ? route(routeName().'.agents.update', $agent->id) : route(routeName().'.agents.store') }}" method="POST" id="form" enctype="multipart/form-data"> @csrf @isset($agent) @method('PUT') <input type="hidden" name="updated_at" value="{{ $agent->id }}"> <input type="hidden" name="agent_manager_id" value="{{ $agent->manager_id }}"> @endisset <div class="card"> <div class="card-body"> <x-form.inputbox name="full_name" labelName="Full Name" required="required" placeholder="Enter name" value="{{ $agent->name ?? old('full_name') }}" error="full_name"/> <x-form.inputbox type="email" name="email" labelName="Email" required="required" placeholder="Enter Email" value="{{ $agent->email ?? old('email') }}" error="email"/> <x-form.inputbox name="phone" labelName="Phone" placeholder="Enter Phone Number" value="{{ $agent->phone_no ?? old('phone') }}" error="phone"/> <x-form.selectbox labelName="Role" name="role" required="required" error="role"> <option value="">-- Select Role --</option> <option value="4" @isset($agent) selected @endisset>Agent</option> </x-form.selectbox> <div class="row"> <div class="col-md-10"> <x-form.inputicon type="password" name="password" labelName="Password" required="required" placeholder="xxxxxxxx" value="{!! isset($agent) ? $agent->password_text : '' !!}" icon="fa fa-eye" error="password" addonClass="password-text cursor-pointer"/> </div> <div class="col-md-2 text-right"> <label for="" class="opacity-0 d-block">hello</label> <button type="button" class="btn btn-md btn-primary generate-pass">Generate</button> </div> </div> @isset($agent) <x-form.selectbox labelName="Manager" name="manager" required="required" error="manager"> <option value="">-- Select Manager --</option> @forelse($managers as $manager) <option value="{{ $manager->id }}" {{ $manager->id == $agent->manager_id ? 'selected' : '' }}>{{ $manager->name }}</option> @empty @endforelse </x-form.selectbox> @endisset <x-form.textarea name="description" labelName="Description" placeholder="Description" rows="5" value="{!! isset($agent) ? $agent->note : '' !!}"> </x-form.textarea> <div class="text-right"> <button class="btn-sm btn btn-success" type="submit"><i class="fa fa-floppy-o"></i> Submit</button> </div> </div> </div> </form> </div> </div> @endsection @push('scripts') <script> // random password generate function generatePass() { let chars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*"; let passLength = 8; let password = ""; for (let i = 0; i < passLength; i++) password += chars[Math.floor(Math.random() * chars.length)]; return password; } // random password value $(document).on('click','button.generate-pass', function(){ $('input[name="password"]').val(generatePass()); }) // password input type text $(document).on('click','.password-text',function(){ if($(this).children().hasClass('fa-eye')){ $(this).children().removeClass('fa-eye'); $(this).children().addClass('fa-eye-slash'); $('input[name="password"]').attr('type','text'); }else{ $(this).children().removeClass('fa-eye-slash'); $(this).children().addClass('fa-eye'); $('input[name="password"]').attr('type','password'); } }); </script> @endpush