bernandotorrez

karyawan-index.blade.php

Oct 22nd, 2020
798
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div>
  2.     <form @if($show_update_form == false) wire:submit.prevent="addData" @else wire:submit.prevent="updateData" @endif>
  3.         <h2 class="alert alert-primary text-center">Add Data Employee</h2>
  4.         <div class="form-group">
  5.             <label for="employee_number">Employee Number</label>
  6.             <input type="text" class="form-control" id="employee_number"
  7.             name="employee_number" placeholder="ESU12334" wire:model.debounce.500ms="employee_number"
  8.             @if($show_update_form == true) readonly @endif>
  9.             @error('employee_number')
  10.             <span class="error" style="color: red;"> {{ $message }} </span>
  11.             @enderror
  12.         </div>
  13.         <div class="form-group">
  14.             <label for="employee_name">Employee Name</label>
  15.             <input type="text" class="form-control" id="employee_name"
  16.             name="employee_name" placeholder="Bernando Torrez" wire:model.debounce.500ms="employee_name">
  17.             @error('employee_name')
  18.             <span class="error" style="color: red;"> {{ $message }} </span>
  19.             @enderror
  20.         </div>
  21.         <div class="form-group">
  22.             <label for="gender">Gender</label>
  23.             <select class="form-control" id="gender" name="gender" wire:model.lazy="gender">
  24.                 <option value=""> - Choose Gender - </option>
  25.                 <option value="M">Man</option>
  26.                 <option value="L">Ladies</option>
  27.             </select>
  28.             @error('gender')
  29.             <span class="error" style="color: red;"> {{ $message }} </span>
  30.             @enderror
  31.         </div>
  32.  
  33.         @if($show_update_form == false)
  34.         <button class="btn btn-primary">Add</button>
  35.         @else
  36.         <button class="btn btn-success">Update</button>
  37.         @endif
  38.     </form>
  39.  
  40.     <p></p>
  41.  
  42.     <table class="table table-bordered">
  43.         <thead>
  44.             <tr>
  45.                 <th> No </th>
  46.                 <th> Employee Number </th>
  47.                 <th> Employee Name </th>
  48.                 <th> Employee Gender </th>
  49.                 <th> Action </th>
  50.             </tr>
  51.         </thead>
  52.  
  53.         <tbody>
  54.             @foreach($employees as $employee)
  55.             <tr>
  56.                 <td>{{ $loop->iteration }}</td>
  57.                 <td>{{ $employee->employee_number }}</td>
  58.                 <td>{{ $employee->employee_name }}</td>
  59.                 <td>{{ $employee->gender }}</td>
  60.                 <td> <button class="btn btn-success" wire:click="showUpdateForm('{{$employee->employee_number}}')"> Edit </button> | <button class="btn btn-danger"> Delete </button> </td>
  61.             </tr>
  62.             @endforeach
  63.         </tbody>
  64.     </table>
  65. </div>
  66.  
RAW Paste Data