Skip to content

Commit

Permalink
Merge pull request #1 from AFFANDRA-SOLUSI-TEKNOLOGI/dev
Browse files Browse the repository at this point in the history
v1.0.2
  • Loading branch information
JastinXyz authored Feb 13, 2024
2 parents 2cd86da + 0492e31 commit c0f593f
Show file tree
Hide file tree
Showing 29 changed files with 167 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_NAME=Laravel
APP_NAME=Nightfall
APP_ENV=local
APP_KEY=
APP_DEBUG=true
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function destroy(string $id)
}

/**
* Print all user
* Print all records
*/
public function print() {
return view('print.user', ['data' => User::all()]);
Expand Down
18 changes: 18 additions & 0 deletions app/View/Components/PrintLayout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class PrintLayout extends Component
{
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('layouts.print');
}
}
Binary file modified public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/views/auth/confirm-password.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="password confirm">
<x-authentication-card>
<x-slot name="logo">
<x-authentication-card-logo />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/forgot-password.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="forgot password">
<x-authentication-card>
<x-slot name="logo">
<x-authentication-card-logo />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="login">
<x-authentication-card>
<x-slot name="logo">
<x-authentication-card-logo />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/register.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="register">
<x-authentication-card>
<x-slot name="logo">
<x-authentication-card-logo />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/reset-password.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="password reset">
<x-authentication-card>
<x-slot name="logo">
<x-authentication-card-logo />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/two-factor-challenge.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="two factor challenge">
<x-authentication-card>
<x-slot name="logo">
<x-authentication-card-logo />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/auth/verify-email.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="verify email">
<x-authentication-card>
<x-slot name="logo">
<x-authentication-card-logo />
Expand Down
12 changes: 6 additions & 6 deletions resources/views/components/button.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
$variantClass = 'bg-gray-800 dark:bg-gray-200 text-white dark:text-gray-800 hover:bg-gray-700 dark:hover:bg-white focus:bg-gray-700 dark:focus:bg-white active:bg-gray-900 dark:active:bg-gray-300';
break;
case 'primary':
$variantClass = 'bg-primary-500 text-white hover:bg-primary-400 focus:bg-primary-700 dark:focus:bg-primary-100 active:bg-primary-900 dark:active:bg-primary-300';
$variantClass = 'bg-primary-500 text-white hover:bg-primary-400 focus:bg-primary-700 dark:focus:bg-primary-500 active:bg-primary-900 dark:active:bg-primary-300';
break;
case 'secondary':
$variantClass = 'bg-fuchsia-500 text-white hover:bg-fuchsia-400 focus:bg-fuchsia-700 dark:focus:bg-fuchsia-100 active:bg-fuchsia-900 dark:active:bg-fuchsia-300';
$variantClass = 'bg-fuchsia-500 text-white hover:bg-fuchsia-400 focus:bg-fuchsia-700 dark:focus:bg-fuchsia-500 active:bg-fuchsia-900 dark:active:bg-fuchsia-300';
break;
case 'success':
$variantClass = 'bg-teal-500 text-white hover:bg-teal-400 focus:bg-teal-700 dark:focus:bg-teal-100 active:bg-teal-900 dark:active:bg-teal-300';
$variantClass = 'bg-teal-500 text-white hover:bg-teal-400 focus:bg-teal-700 dark:focus:bg-teal-500 active:bg-teal-900 dark:active:bg-teal-300';
break;
case 'info':
$variantClass = 'bg-sky-500 text-white hover:bg-sky-400 focus:bg-sky-700 dark:focus:bg-sky-100 active:bg-sky-900 dark:active:bg-sky-300';
$variantClass = 'bg-sky-500 text-white hover:bg-sky-400 focus:bg-sky-700 dark:focus:bg-sky-500 active:bg-sky-900 dark:active:bg-sky-300';
break;
case 'danger':
$variantClass = 'bg-red-500 text-white hover:bg-red-400 focus:bg-red-700 dark:focus:bg-red-100 active:bg-red-900 dark:active:bg-red-300';
$variantClass = 'bg-red-500 text-white hover:bg-red-400 focus:bg-red-700 dark:focus:bg-red-500 active:bg-red-900 dark:active:bg-red-300';
break;
case 'warning':
$variantClass = 'bg-yellow-500 text-white hover:bg-yellow-400 focus:bg-yellow-700 dark:focus:bg-yellow-100 active:bg-yellow-900 dark:active:bg-yellow-300';
$variantClass = 'bg-yellow-500 text-white hover:bg-yellow-400 focus:bg-yellow-700 dark:focus:bg-yellow-500 active:bg-yellow-900 dark:active:bg-yellow-300';
break;
default:
$variantClass = 'bg-gray-800 dark:bg-gray-200 text-white dark:text-gray-800 hover:bg-gray-700 dark:hover:bg-white focus:bg-gray-700 dark:focus:bg-white active:bg-gray-900 dark:active:bg-gray-300';
Expand Down
13 changes: 12 additions & 1 deletion resources/views/components/input.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
@props(['disabled' => false])

<input {{ $disabled ? 'disabled' : '' }} {!! $attributes->merge(['class' => 'border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-primary-500 dark:focus:border-primary-600 focus:ring-primary-500 dark:focus:ring-primary-600 rounded-md shadow-sm']) !!}>
@if($attributes->get('type') === 'password')
<div class="relative">
<input {{ $disabled ? 'disabled' : '' }} {!! $attributes->merge(['class' => 'border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-primary-500 dark:focus:border-primary-600 focus:ring-primary-500 dark:focus:ring-primary-600 rounded-md shadow-sm']) !!}>
<div aria-hidden="true" class="absolute inset-y-0 right-0 flex items-center pr-4 cursor-pointer"
onclick="document.getElementById('{{ $attributes->get('id') }}').type = document.getElementById('{{ $attributes->get('id') }}').type === 'password' ? 'text' : 'password'"
>
<x-heroicon-o-eye-slash aria-hidden="true" class="w-5 h-5" />
</div>
</div>
@else
<input {{ $disabled ? 'disabled' : '' }} {!! $attributes->merge(['class' => 'border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-primary-500 dark:focus:border-primary-600 focus:ring-primary-500 dark:focus:ring-primary-600 rounded-md shadow-sm']) !!}>
@endif
9 changes: 7 additions & 2 deletions resources/views/components/link.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
@props([
'href' => '#',
'text' => false
'text' => false,
'hardRefresh' => false
])

<a href="{{ $href }}" {{ $attributes }} wire:navigate>{{ $text ? $text : $slot }}</a>
@if($hardRefresh)
<a href="{!! $href !!}" {{ $attributes }}>{{ $text ? $text : $slot }}</a>
@else
<a href="{!! $href !!}" {{ $attributes }} wire:navigate>{{ $text ? $text : $slot }}</a>
@endif
3 changes: 3 additions & 0 deletions resources/views/components/print-layout.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<!-- He who is contented is rich. - Laozi -->
</div>
2 changes: 1 addition & 1 deletion resources/views/components/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div class="drawer-side">
<label for="my-drawer-2" aria-label="close sidebar" class="drawer-overlay"></label>
<ul class="menu bg-white dark:bg-gray-800 border-r border-gray-100 dark:border-gray-700 p-4 w-72 min-h-full text-base-content">
<ul class="menu bg-white dark:bg-gray-800 border-r border-gray-100 dark:border-gray-700 p-4 w-60 md:w-72 min-h-full text-base-content">
<div class="shrink-0 flex items-center mb-10">
<a href="{{ route('dashboard') }}">
<x-application-logo class="block h-9 w-auto" />
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/button.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-app-layout>
<x-app-layout where="buttons">
<x-slot name="header">
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/user/create.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-app-layout>
<x-app-layout where="create new user">
<x-slot name="header">
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/user/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-app-layout>
<x-app-layout where="edit user">
<x-slot name="header">
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
Expand Down
7 changes: 5 additions & 2 deletions resources/views/dashboard/user/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<x-app-layout>
<x-app-layout where="user">
<x-slot name="header">
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('User') }}
</h2>
<x-button variant="primary" href="{{ route('user.create') }}">Add</x-button>
<div class="flex gap-2">
<x-button variant="primary" href="{{ route('user.print') }}" target="_blank" hardRefresh>Print</x-button>
<x-button variant="primary" href="{{ route('user.create') }}">Add</x-button>
</div>
</div>
</x-slot>

Expand Down
4 changes: 3 additions & 1 deletion resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
@props(['where' => 'Dashboard'])

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'Laravel') }}</title>
<title>{{ config('app.name', 'Nightfall') }} - {{ Str::title($where) }}</title>

<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
Expand Down
4 changes: 3 additions & 1 deletion resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
@props(['where' => null])

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'Laravel') }}</title>
<title>{{ config('app.name', 'Nightfall').($where ? " - ".Str::title($where) : '') }}</title>

<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
Expand Down
60 changes: 60 additions & 0 deletions resources/views/layouts/print.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@props(['where' => 'Print'])

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ config('app.name', 'Nightfall') }} - {{ Str::title($where) }}</title>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paper-css/0.3.0/paper.css">
<style>
@page {
margin: 50px !important;
size: A4
}
@media print {
.no-print,
.no-print * {
display: none !important;
}
}
.sheet {
overflow: visible;
height: auto !important;
}
table {
width: 100%;
}
table.header th,
table.header td {
text-align: left;
vertical-align: top;
}
table#journal > thead > tr > th,
table#journal > tbody > tr > td {
text-align: left;
padding: 0.25rem 0.5rem 0.25rem 0.5rem;
}
.button {
background-color: #2E2E2E;
color: #f1f1f1;
padding: 8px;
cursor: pointer;
}
</style>
</head>
<body class="A4" style="padding-top: 50px;">
<center>
<div class="no-print">
<button class="button" onclick="window.print()">Print/Download PDF</button>
</div>

<section class="sheet padding-10mm">
{{ $slot }}
</section>
</center>
</body>
</html>
2 changes: 1 addition & 1 deletion resources/views/policy.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="privacy policy">
<div class="pt-4 bg-gray-100 dark:bg-gray-900">
<div class="min-h-screen flex flex-col items-center pt-6 sm:pt-0">
<div>
Expand Down
31 changes: 31 additions & 0 deletions resources/views/print/user.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<x-print-layout where="user print">
<center>
<h2>All User</h2>
</center>

<hr>
<table id="journal" style="width: 100%; font-family: arial, sans-serif; border-collapse: collapse;">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th>Email</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
@php
$i = 1;
@endphp

@foreach ($data as $item)
<tr>
<td>{{ $i++ }}</td>
<td>{{ $item->name }}</td>
<td>{{ $item->email }}</td>
<td>{{ $item->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
</x-print-layout>
2 changes: 1 addition & 1 deletion resources/views/profile/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-app-layout>
<x-app-layout where="profile">
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Profile') }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/terms.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="terms of service">
<div class="pt-4 bg-gray-100 dark:bg-gray-900">
<div class="min-h-screen flex flex-col items-center pt-6 sm:pt-0">
<div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-guest-layout>
<x-guest-layout where="home">
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100 dark:bg-gray-900">
<div>
<a href="https://github.com/affandra-solusi-teknologi/nightfall" target="_blank">
Expand Down Expand Up @@ -29,7 +29,7 @@
</div>
@endauth
@endif
<p class="mt-2 font-medium text-gray-500 dark:text-gray-400 leading-relaxed"><a href="https://github.com/affandra-solusi-teknologi/nightfall" target="_blank" class="hover:text-white transition">Nightfall</a> v1.0.0 PHP v{{ PHP_VERSION }}</p>
<p class="mt-2 font-medium text-gray-500 dark:text-gray-400 leading-relaxed"><a href="https://github.com/affandra-solusi-teknologi/nightfall" target="_blank" class="hover:text-white transition">Nightfall</a> v1.0.2 PHP v{{ PHP_VERSION }}</p>
</div>
</div>
</x-guest-layout>
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
return view('dashboard');
})->name('dashboard');

Route::get('/user/print', [UserController::class, 'print'])->name('user.print');
Route::resource('/user', UserController::class, ['names' => 'user']);

// you can remove this routes
Expand Down

0 comments on commit c0f593f

Please sign in to comment.