@@ -67,6 +90,7 @@ class EmployeeController extends Controller
'gender'=>'required',
'department'=>'required',
'employee_no'=>'required',
<<<<<<<8c98d41a67e0ec45e1fd64b04b779360352c1dcf
'personal_phoneno'=>'required',
'krapin'=>'required',
'nssf_no'=>'required',
...
...
@@ -80,27 +104,55 @@ class EmployeeController extends Controller
]);
// Fetching the department and business unit codes
$branch_code=DB::table('branches')->select('business_unit_code')->where('id',Input::get('businessunit'))->pluck('business_unit_code');#pulls the businessunitcode as a collection
=======
'personal_phone_no'=>'required',
'kra_pin'=>'required',
'nssf_no'=>'required',
'nhif_no'=>'required',
'reporting_manager'=>'required',
'role'=>'required',
'employment_status'=>'required',
'date_of_joining'=>'required',
'years_of_experience'=>'required',
'email_address'=>'required|unique:employees'
]);
// Fetching the department and business unit codes
$branch_code=DB::table('branches')->select('business_unit_code')->where('id',Input::get('business_unit'))->pluck('business_unit_code');#pulls the businessunitcode as a collection
>>>>>>>Storingemployeeinfo
$branchcode=$branch_code[0];#references the index of the pulled collection
$department_code=DB::table('departments')->select('department_code')->where('id',Input::get('department'))->pluck('department_code');#pulls the departmentcode as a collection
$departmentcode=$department_code[0];#references the index of the pulled collection
$employeeNo=Input::get('employee_no');
<<<<<<<8c98d41a67e0ec45e1fd64b04b779360352c1dcf
// Inserting employeeid based on branch,department or a noneapplicable select option of employeecode
if($request->employeecode==1){
$employeeid=$branchcode.$employeeNo;
}elseif($request->employeecode==2){
=======
// Inserting employeeid based on branch,department or a noneapplicable select option of employee_code
if($request->employee_code==1){
$employeeid=$branchcode.$employeeNo;
}elseif($request->employee_code==2){
>>>>>>>Storingemployeeinfo
$employeeid=$departmentcode.$employeeNo;
}else{
$employeeid=$employeeNo;
}
<<<<<<<8c98d41a67e0ec45e1fd64b04b779360352c1dcf
DB::table('employees')
=======
$employee_id=DB::table('employees')
>>>>>>>Storingemployeeinfo
->insertGetId([
'prefix'=>$request['prefix'],
'first_name'=>$request['first_name'],
'last_name'=>$request['last_name'],
'middle_name'=>$request['middle_name'],
'gender'=>$request['gender'],
<<<<<<<8c98d41a67e0ec45e1fd64b04b779360352c1dcf
'business_unit'=>$request['businessunit'],
'department'=>$request['department'],
'employee_id'=>$employeeid,
...
...
@@ -109,11 +161,22 @@ class EmployeeController extends Controller
<buttondata-toggle="tooltip"data-placement="top"title="Delete"type="submit"class="btn btn-danger"onclick="return confirm('Are you sure you want to delete this item?');"><iclass="fa fa-trash no-margin"></i></button>
</form>
</td>
</tr>
@endforeach
@else
<tr>
<tdcolspan="2"class="text-center">Nothing to display</td>
<option value="MobilityorOrthopedicdisability" @if($selected_disability_type=$employee->disability_type) {{'selected'}} @endif>Mobility or Orthopedic disability</option>
<option value="Speechorlanguageimpairments" @if($selected_disability_type=$employee->disability_type) {{'selected'}} @endif>Speech or language impairments</option>
<button data-toggle="tooltip" data-placement="top" title="Delete" type="submit" class="btnbtn-danger" onclick="returnconfirm('Are you sure you want to delete this item?');"><i class="fafa-trashno-margin"></i></button>
</form>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="2" class="text-center">Nothing to display</td>
<button data-toggle="tooltip" data-placement="top" title="Delete" type="submit" class="btnbtn-danger" onclick="returnconfirm('Are you sure you want to delete this item?');"><i class="fafa-trashno-margin"></i></button>
</form>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="2" class="text-center">Nothing to display</td>
<button data-toggle="tooltip" data-placement="top" title="Delete" type="submit" class="btnbtn-danger" onclick="returnconfirm('Are you sure you want to delete this item?');"><i class="fafa-trashno-margin"></i></button>
</form>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="2" class="text-center">Nothing to display</td>
<button data-toggle="tooltip" data-placement="top" title="Delete" type="submit" class="btnbtn-danger" onclick="returnconfirm('Are you sure you want to delete this item?');"><i class="fafa-trashno-margin"></i></button>
</form>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="2" class="text-center">Nothing to display</td>
<selectname="businessunit"id="businessunit"class="form-control selectpicker"data-live-search="true"title="Select Business Unit"style="width:15em;"data-size="5"onfocus='this.size=5;'onblur='this.size=1;'onchange='this.size=1; this.blur();'>
=======
<selectname="business_unit"id="businessunit"class="form-control selectpicker"data-live-search="true"title="Select Business Unit"style="width:15em;"data-size="5"onfocus='this.size=5;'onblur='this.size=1;'onchange='this.size=1; this.blur();'>
<option value="MobilityorOrthopedicdisability" @if($selected_disability_type=$employee->disability_type) {{'selected'}} @endif>Mobility or Orthopedic disability</option>
<option value="Speechorlanguageimpairments" @if($selected_disability_type=$employee->disability_type) {{'selected'}} @endif>Speech or language impairments</option>