new commit
This commit is contained in:
@@ -29,6 +29,7 @@ use App\Helpers\NotificationHelper;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Services\BrevoService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Container\Attributes\Auth;
|
||||
|
||||
class FormUpCountryController extends Controller
|
||||
{
|
||||
@@ -372,7 +373,19 @@ class FormUpCountryController extends Controller
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$regionId = Cabang::where('id', 1)->value('region_id');
|
||||
$rayonData = Rayon::where('cabang_id', $cabang->id)->get();
|
||||
|
||||
if ($role = "Admin Region" || "Marketing Information System" || "Superadmin") {
|
||||
$rayonData = DB::table('rayon')
|
||||
->join('cabang', 'rayon.cabang_id', '=', 'cabang.id')
|
||||
->join('region', 'cabang.region_id', '=', 'region.id')
|
||||
->where('region.id', $regionId)
|
||||
->select('rayon.*')
|
||||
->get();
|
||||
|
||||
}
|
||||
|
||||
$form = FormUpCountry::with('rayon')->findOrfail($id);
|
||||
if (($form->status != 'On Progress' && $form->status != 'Rejected') && $role == 'Medical Representatif') {
|
||||
session()->flash('error', 'You cannot edit this form because it has been approved or closed.');
|
||||
@@ -380,7 +393,7 @@ class FormUpCountryController extends Controller
|
||||
}
|
||||
|
||||
return view('backend.pages.forms.upcountry.edit', [
|
||||
'rayons' => Rayon::where('cabang_id', $cabang->id)->get(),
|
||||
'rayons' => $rayonData,
|
||||
'form' => $form
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user