Sfoglia il codice sorgente

check all wo when delete staff - auto deassign

ifah
Siti Hajar Ibrahim 5 anni fa
parent
commit
6eb1c7f8d8

+ 13
- 6
app/Http/Controllers/Contractor/ContractorController.php Vedi File

@@ -669,7 +669,6 @@ class ContractorController extends Controller
foreach ($agent as $a)
{
$n1 = '';
$reg_time = $a->updated_at;
$expiry_date = $reg_time->addDays(3);
$expiry_date = $expiry_date->getTimestamp();
@@ -679,6 +678,7 @@ class ContractorController extends Controller
}

if($a->company_id == $user->StaffDetail->company_id){
$i++;
array_push($nested_data, array(
'index' => $n1.$i,
'user_pic' => $a->StaffDetail->user_pic,
@@ -691,8 +691,7 @@ class ContractorController extends Controller
'action' => $a->_id
));

}
$i++;
}
}
return \DataTables::of($nested_data)->make(true);
}
@@ -826,16 +825,24 @@ class ContractorController extends Controller

public function deleteInstaller(Request $request){

$staff = Staff::where('_id',$request->id)->first();
$staff = Staff::where('_id',$request->id)->first();
if(!empty($staff)){
$st = StaffDetail::where('email',$staff->email)->first();
if(!empty($st)){
$st->delete();
$staff->delete();
return 'true';
}

$wo = WorkOrder::where('installer_id',$request->id)->where('status','like','%Pending%')->get();
foreach ($wo as $w){
$w->status = "Pending Contractor";
$w->installer_id = "";
$w->save();
}
return 'true';
}else {
return 'false';
}

+ 1
- 1
resources/views/contractor/view_team.blade.php Vedi File

@@ -109,7 +109,7 @@
{
"render": function ( data, type, row ) {
var link = "{{ url('/contractor/team/edit') }}"+"/"+data;
return '<a href="'+link+'" class="tablectrl_medium bLightBlue tipS" title="Edit Agent"><span class="iconb" data-icon="&#xe003;"></span></a> <a class="tablectrl_medium bRed tipS delModule" onclick="deleteA(\''+data+'\',\'' + row.name + '\',\'' + row.email + '\', )" title="Delete Agent"><span class="iconb" data-icon="&#xe136;"></span></a>';
return '<a href="'+link+'" class="tablectrl_medium bLightBlue tipS" title="Edit Installer"><span class="iconb" data-icon="&#xe003;"></span></a> <a class="tablectrl_medium bRed tipS delModule" onclick="deleteA(\''+data+'\',\'' + row.name + '\',\'' + row.email + '\', )" title="Delete Installer"><span class="iconb" data-icon="&#xe136;"></span></a>';
},
"targets": 8
},

Loading…
Annulla
Salva