From 7a5d331b6c44666a938b0c599433ab25fd10cbcf Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Sat, 11 Jan 2025 21:29:31 +0600 Subject: [PATCH] wip --- .../Controllers/Staff/ReportController.php | 4 +- ...portRequest.php => StoreReportRequest.php} | 2 +- resources/css/editor.css | 33 +++++++++ resources/js/editor.js | 69 +++++++++++++++++++ .../reports/viewer/html-report.blade.php | 69 ++++++++++--------- .../staff/reports/viewer/layout.blade.php | 4 +- vite.config.js | 12 +++- 7 files changed, 152 insertions(+), 41 deletions(-) rename app/Http/Requests/{CreateReportRequest.php => StoreReportRequest.php} (93%) create mode 100644 resources/css/editor.css create mode 100644 resources/js/editor.js diff --git a/app/Http/Controllers/Staff/ReportController.php b/app/Http/Controllers/Staff/ReportController.php index 22577f6..d68f821 100644 --- a/app/Http/Controllers/Staff/ReportController.php +++ b/app/Http/Controllers/Staff/ReportController.php @@ -5,7 +5,7 @@ use App\Domain\ACL\Permission; use App\Domain\Report\ReportStatus; use App\Http\Controllers\HashidControllerBase; -use App\Http\Requests\CreateReportRequest; +use App\Http\Requests\StoreReportRequest; use App\Models\Study; use App\Models\StudyReport; @@ -25,7 +25,7 @@ public function popup() return view('staff.reports.popup', compact('study', 'reports')); } - public function save(CreateReportRequest $request) + public function save(StoreReportRequest $request) { abort_unless(me()->may([Permission::ReportEdit, Permission::ReportDictate, Permission::ReportApprove]), 403); $this->decodeKeys(); diff --git a/app/Http/Requests/CreateReportRequest.php b/app/Http/Requests/StoreReportRequest.php similarity index 93% rename from app/Http/Requests/CreateReportRequest.php rename to app/Http/Requests/StoreReportRequest.php index f6d13f0..a9a82bc 100644 --- a/app/Http/Requests/CreateReportRequest.php +++ b/app/Http/Requests/StoreReportRequest.php @@ -8,7 +8,7 @@ use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rule; -class CreateReportRequest extends FormRequest +class StoreReportRequest extends FormRequest { public function authorize(): bool { diff --git a/resources/css/editor.css b/resources/css/editor.css new file mode 100644 index 0000000..59337aa --- /dev/null +++ b/resources/css/editor.css @@ -0,0 +1,33 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,700;1,400;1,700&display=swap'); + +@media print { + body { + margin: 0 !important; + } +} + +.main-container { + font-family: 'Inter'; + width: fit-content; + margin-left: auto; + margin-right: auto; +} + +.fixed-container { + min-height: 600px; + min-width: 300px; + /*height: 800px;*/ + height: 100%; + width: 100%; +} + +.ck-content { + font-family: 'Inter'; + line-height: 1.6; + word-break: break-word; +} + +.editor-container_classic-editor .editor-container__editor { + min-width: 600px; + min-height: 600px; +} diff --git a/resources/js/editor.js b/resources/js/editor.js new file mode 100644 index 0000000..9ff823d --- /dev/null +++ b/resources/js/editor.js @@ -0,0 +1,69 @@ +document.addEventListener('DOMContentLoaded', () => { + + const { + ClassicEditor, + Bold, + Essentials, + Italic, + List, + ListProperties, + Paragraph, + PasteFromOffice, + RemoveFormat, + Table, + TableCellProperties, + TableColumnResize, + TableProperties, + TableToolbar, + Underline + } = window.CKEDITOR; +//const {PasteFromOfficeEnhanced} = window.CKEDITOR_PREMIUM_FEATURES; + + const LICENSE_KEY = 'eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE3NjcxMzkxOTksImp0aSI6ImQ4ODJkYTBmLWNmYWUtNGU4Mi05ZjYxLTYyYzY4ZmZiZWUzMCIsInVzYWdlRW5kcG9pbnQiOiJodHRwczovL3Byb3h5LWV2ZW50LmNrZWRpdG9yLmNvbSIsImRpc3RyaWJ1dGlvbkNoYW5uZWwiOlsiY2xvdWQiLCJkcnVwYWwiXSwiZmVhdHVyZXMiOlsiRFJVUCJdLCJ2YyI6IjI0OGE5ZjdhIn0.m-nfFNt3CYv4_P81vYJn8nTGJeIXXi2hWIFr7EnWNVNkyW_wmIt3Oh_1lOiQE43kN9LXpM0-jEyomb1sSqkwzw'; +//const LICENSE_KEY = 'eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE3MzY4MTI3OTksImp0aSI6IjRkNDQyODQ2LWIwNDUtNDU1Ny1hZTY0LTM3ZDE0OTdkYWIxNSIsInVzYWdlRW5kcG9pbnQiOiJodHRwczovL3Byb3h5LWV2ZW50LmNrZWRpdG9yLmNvbSIsImRpc3RyaWJ1dGlvbkNoYW5uZWwiOlsiY2xvdWQiLCJkcnVwYWwiLCJzaCJdLCJ3aGl0ZUxhYmVsIjp0cnVlLCJsaWNlbnNlVHlwZSI6InRyaWFsIiwiZmVhdHVyZXMiOlsiKiJdLCJ2YyI6ImIwYmRlYmVjIn0.fhO6LXEF3lP_QpHQY2c9hPnensaY2_0AbfgJ0p4wUlQFmIyn-9dwe5rbMh9SdZYgoqOY5J4-zN0-JfO2vFm3vg'; + + const editorConfig = { + toolbar: { + items: ['bold', 'italic', 'underline', 'removeFormat', '|', 'insertTable', '|', 'bulletedList', 'numberedList'], + shouldNotGroupWhenFull: false + }, + plugins: [ + Bold, + Essentials, + Italic, + List, + ListProperties, + Paragraph, + PasteFromOffice, + //PasteFromOfficeEnhanced, + RemoveFormat, + Table, + TableCellProperties, + TableColumnResize, + TableProperties, + TableToolbar, + Underline + ], + initialData: '', + licenseKey: LICENSE_KEY, + list: { + properties: { + styles: true, + startIndex: true, + reversed: true + } + }, + menuBar: { + isVisible: true + }, + placeholder: 'Type or paste your content here!', + table: { + contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells', 'tableProperties', 'tableCellProperties'] + } + }; + + ClassicEditor.create(document.querySelector('#editor'), editorConfig); + + console.log("CKE"); + +}); diff --git a/resources/views/staff/reports/viewer/html-report.blade.php b/resources/views/staff/reports/viewer/html-report.blade.php index 31a21e7..11b75b2 100644 --- a/resources/views/staff/reports/viewer/html-report.blade.php +++ b/resources/views/staff/reports/viewer/html-report.blade.php @@ -4,44 +4,47 @@
-
- - - - - - - - - - - - - - - - - - - - - -
Patient Name{{ $report->study->patient_name }}Patient ID{{ $report->study->patient_id }}
Age/Gender{{ $report->study->sexAge() }}Accession No{{ $report->study->accession_number }}
Referred By{{ $report->study->referring_physician_name }}Date{{ $report->created_at->format('d-M-Y') }}
- -
-
- {{ $report->study->modality }} Report -
-

- {{ $report->study->study_description }} -

-
- +
+
+ {{ $report->study->modality }} Report +
+

+ {{ $report->study->study_description }} +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Patient Name{{ $report->study->patient_name }}ID{{ $report->study->patient_id }}
Age / Gender{{ $report->study->sexAge() }}Accession No{{ $report->study->accession_number }}
Referred By{{ $report->study->referring_physician_name }}Date{{ $report->created_at->format('d-M-Y') }}
+
+
+
+
diff --git a/resources/views/staff/reports/viewer/layout.blade.php b/resources/views/staff/reports/viewer/layout.blade.php index 5baff37..67b40ba 100644 --- a/resources/views/staff/reports/viewer/layout.blade.php +++ b/resources/views/staff/reports/viewer/layout.blade.php @@ -21,8 +21,8 @@ diff --git a/vite.config.js b/vite.config.js index d74fbe9..ebde160 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,7 +16,7 @@ function GetFilesArray(query) { /** * Js Files */ -// Ppp JS Files +// App JS Files const appJsFiles = GetFilesArray('resources/js/*.js'); const appCssFiles = GetFilesArray('resources/css/*.css'); @@ -69,8 +69,6 @@ export default defineConfig({ 'resources/css/app.css', 'resources/assets/css/demo.css', //'resources/js/app.js', - ...appJsFiles, - ...appCssFiles, ...pageJsFiles, ...vendorJsFiles, ...LibsJsFiles, @@ -85,6 +83,14 @@ export default defineConfig({ }), viteStaticCopy({ targets: [ + { + src: [...appJsFiles], + dest: '../js' + }, + { + src: [...appCssFiles], + dest: '../css' + }, { src: [...ImageFiles], dest: '../imgs'