%PDF- %PDF-
Direktori : /home/silvzytp/calling_code/resources/views/backend/pages/admin/ |
Current File : //home/silvzytp/calling_code/resources/views/backend/pages/admin/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($admin) Update @else Submit @endisset </button> @endsection @push('styles') @endpush @section('content') <div class="row"> <div class="col-12"> <form action="{{ isset($admin) ? route(routeName().'.admins.update', $admin->id) : route(routeName().'.admins.store') }}" method="POST" id="form" enctype="multipart/form-data"> @csrf @isset($admin) @method('PUT') <input type="hidden" name="updated_at" value="{{ $admin->id }}"> @endisset <div class="row"> <div class="col-md-8"> <div class="card"> <div class="card-body"> <x-form.inputbox name="full_name" labelName="Full Name" required="required" placeholder="Enter name" value="{{ $admin->name ?? old('full_name') }}" error="full_name"/> <x-form.inputbox type="email" name="email" labelName="Email" required="required" placeholder="Enter Email" value="{{ $admin->email ?? old('email') }}" error="email"/> <x-form.inputbox name="phone" labelName="Phone" placeholder="Enter Phone Number" value="{{ $admin->phone_no ?? old('phone') }}" error="phone"/> <div class="row"> <div class="col-md-10"> <x-form.inputicon type="password" name="password" labelName="Password" required="required" placeholder="xxxxxxxx" value="{!! isset($admin) ? $admin->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">hello</label> <button type="button" class="btn btn-md btn-primary generate-pass">Generate</button> </div> </div> </div> </div> </div> <div class="col-md-4"> <div class="card"> <div class="card-body"> <x-form.selectbox labelName="Role" name="role" required="required" error="role"> <option value="">-- Select Role --</option> <option value="2" @isset($admin) selected @endisset>Admin</option> </x-form.selectbox> <x-form.selectbox labelName="Status" name="status" required="required" error="status"> <option value="">-- Select Status --</option> <option value="1" @isset($admin) {{ $admin->status == 1 ? 'selected' : '' }} @endisset>Enabled</option> <option value="2" @isset($admin) {{ $admin->status == 2 ? 'selected' : '' }} @endisset>Disabled</option> </x-form.selectbox> <x-form.inputbox type="file" name="profile" labelName="Profile" error="profile"/> </div> </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