fix: projects with 0 envs
This commit is contained in:
		@@ -23,7 +23,7 @@
 | 
			
		||||
        <div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
 | 
			
		||||
            @foreach ($projects as $project)
 | 
			
		||||
                <div class="gap-2 border border-transparent cursor-pointer box group"
 | 
			
		||||
                    onclick="window.location.href = '{{ route('project.resource.index', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => $project->default_environment()->name]) }}'">
 | 
			
		||||
                    onclick="gotoProject('{{ $project->uuid }}','{{ $project->default_environment()?->name }}')">
 | 
			
		||||
                    <div class="flex flex-1 mx-6">
 | 
			
		||||
                        <div class="flex flex-col justify-center flex-1">
 | 
			
		||||
                            <div class="box-title">{{ $project->name }}</div>
 | 
			
		||||
@@ -160,7 +160,10 @@
 | 
			
		||||
    @endif
 | 
			
		||||
 | 
			
		||||
    <script>
 | 
			
		||||
        function gotoProject(uuid, environment = 'production') {
 | 
			
		||||
        function gotoProject(uuid, environment) {
 | 
			
		||||
            if (!environment) {
 | 
			
		||||
                window.location.href = '/project/' + uuid;
 | 
			
		||||
            }
 | 
			
		||||
            window.location.href = '/project/' + uuid + '/' + environment;
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
 
 | 
			
		||||
@@ -12,12 +12,12 @@
 | 
			
		||||
    <div class="grid gap-2 lg:grid-cols-2">
 | 
			
		||||
        @forelse ($projects as $project)
 | 
			
		||||
            <div class="box group" x-data x-on:click="goto('{{ $project->uuid }}')">
 | 
			
		||||
                <a class="flex flex-col justify-center flex-1 mx-6"
 | 
			
		||||
                    href="{{ route('project.resource.index', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => $project->default_environment()->name]) }}">
 | 
			
		||||
                <div class="flex flex-col justify-center flex-1 mx-6"
 | 
			
		||||
                    onclick="gotoProject('{{ $project->uuid }}','{{ $project->default_environment()?->name }}')">
 | 
			
		||||
                    <div class="box-title">{{ $project->name }}</div>
 | 
			
		||||
                    <div class="box-description ">
 | 
			
		||||
                        {{ $project->description }}</div>
 | 
			
		||||
                </a>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="flex items-center justify-center gap-2 pt-4 pb-2 mr-4 text-xs lg:py-0 lg:justify-normal">
 | 
			
		||||
                    <a class="mx-4 font-bold hover:underline"
 | 
			
		||||
                        href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}">
 | 
			
		||||
@@ -36,5 +36,12 @@
 | 
			
		||||
        function goto(uuid) {
 | 
			
		||||
            window.location.href = '/project/' + uuid;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function gotoProject(uuid, environment) {
 | 
			
		||||
            if (!environment) {
 | 
			
		||||
                window.location.href = '/project/' + uuid;
 | 
			
		||||
            }
 | 
			
		||||
            window.location.href = '/project/' + uuid + '/' + environment;
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user