diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index aa773d9eea5f..1e8f90b6c2c2 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -797,7 +797,7 @@ public function postLabels(StoreLabelSettings $request) : RedirectResponse $setting->labels_pagewidth = $request->input('labels_pagewidth'); $setting->labels_pageheight = $request->input('labels_pageheight'); $setting->labels_display_company_name = $request->input('labels_display_company_name', '0'); - $setting->labels_display_company_name = $request->input('labels_display_company_name', '0'); + $setting->label_cell_margin_top = $request->input('label_cell_margin_top'); diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php index 9f5fa735e4d1..09f7c016045e 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php @@ -3,6 +3,8 @@ namespace App\Models\Labels\Tapes\Dymo; +use App\Models\Setting; + class LabelWriter_1933081 extends LabelWriter { private const BARCODE_MARGIN = 1.80; @@ -32,7 +34,7 @@ public function write($pdf, $record) { $currentX = $pa->x1; $currentY = $pa->y1; $usableWidth = $pa->w; - + $cell_margin_top = Setting::getSettings()->label_cell_margin_top; $barcodeSize = $pa->h - self::TAG_SIZE; if ($record->has('barcode2d')) { @@ -49,12 +51,12 @@ public function write($pdf, $record) { ); $currentX += $barcodeSize + self::BARCODE_MARGIN; $usableWidth -= $barcodeSize + self::BARCODE_MARGIN; - } - + } + $titleY = $pa->y1; if ($record->has('title')) { static::writeText( $pdf, $record->get('title'), - $currentX, $currentY, + $currentX, $titleY, 'freesans', 'b', self::TITLE_SIZE, 'L', $usableWidth, self::TITLE_SIZE, true, 0 ); @@ -64,7 +66,7 @@ public function write($pdf, $record) { foreach ($record->get('fields') as $field) { static::writeText( $pdf, (($field['label']) ? $field['label'].' ' : '') . $field['value'], - $currentX, $currentY, + $currentX, $currentY + $cell_margin_top, 'freesans', '', self::FIELD_SIZE, 'L', $usableWidth, self::FIELD_SIZE, true, 0, 0.3 ); diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php index 117486a8e567..89a6f5949bdf 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_2112283.php @@ -3,6 +3,8 @@ namespace App\Models\Labels\Tapes\Dymo; +use App\Models\Setting; + class LabelWriter_2112283 extends LabelWriter { private const BARCODE_MARGIN = 1.80; @@ -32,7 +34,7 @@ public function write($pdf, $record) { $currentX = $pa->x1; $currentY = $pa->y1; $usableWidth = $pa->w; - + $cell_margin_top = Setting::getSettings()->label_cell_margin_top; $barcodeSize = $pa->h - self::TAG_SIZE; if ($record->has('barcode2d')) { @@ -51,6 +53,7 @@ public function write($pdf, $record) { $usableWidth -= $barcodeSize + self::BARCODE_MARGIN; } + $titleY = $pa->y1; if ($record->has('title')) { static::writeText( $pdf, $record->get('title'), @@ -58,13 +61,13 @@ public function write($pdf, $record) { 'freesans', 'b', self::TITLE_SIZE, 'L', $usableWidth, self::TITLE_SIZE, true, 0 ); - $currentY += self::TITLE_SIZE + self::TITLE_MARGIN; + $currentY += $titleY + self::TITLE_SIZE + self::TITLE_MARGIN; } foreach ($record->get('fields') as $field) { static::writeText( $pdf, (($field['label']) ? $field['label'].' ' : '') . $field['value'], - $currentX, $currentY, + $currentX, $currentY + $cell_margin_top, 'freesans', '', self::FIELD_SIZE, 'L', $usableWidth, self::FIELD_SIZE, true, 0, 0.3 ); diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php index ed8074547be2..395fb832ff74 100644 --- a/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php +++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_30252.php @@ -3,6 +3,8 @@ namespace App\Models\Labels\Tapes\Dymo; +use App\Models\Setting; + class LabelWriter_30252 extends LabelWriter { private const BARCODE_MARGIN = 1.80; @@ -33,7 +35,7 @@ public function write($pdf, $record) { $currentX = $pa->x1; $currentY = $pa->y1; $usableWidth = $pa->w; - + $cell_margin_top = Setting::getSettings()->label_cell_margin_top; $barcodeSize = $pa->h - self::TAG_SIZE; if ($record->has('barcode2d')) { @@ -51,11 +53,11 @@ public function write($pdf, $record) { $currentX += $barcodeSize + self::BARCODE_MARGIN; $usableWidth -= $barcodeSize + self::BARCODE_MARGIN; } - + $titleY= $pa->y1; if ($record->has('title')) { static::writeText( $pdf, $record->get('title'), - $currentX, $currentY, + $currentX, $titleY, 'freesans', '', self::TITLE_SIZE, 'L', $usableWidth, self::TITLE_SIZE, true, 0 ); @@ -65,7 +67,7 @@ public function write($pdf, $record) { foreach ($record->get('fields') as $field) { static::writeText( $pdf, $field['label'], - $currentX, $currentY, + $currentX, $currentY + $cell_margin_top, 'freesans', '', self::LABEL_SIZE, 'L', $usableWidth, self::LABEL_SIZE, true, 0, 0 ); @@ -73,7 +75,7 @@ public function write($pdf, $record) { static::writeText( $pdf, $field['value'], - $currentX, $currentY, + $currentX, $currentY+ $cell_margin_top, 'freemono', 'B', self::FIELD_SIZE, 'L', $usableWidth, self::FIELD_SIZE, true, 0, 0.3 ); diff --git a/database/migrations/2024_11_19_175046_add_label_cell_margin_top_to_settings.php b/database/migrations/2024_11_19_175046_add_label_cell_margin_top_to_settings.php new file mode 100644 index 000000000000..9840c931a74c --- /dev/null +++ b/database/migrations/2024_11_19_175046_add_label_cell_margin_top_to_settings.php @@ -0,0 +1,28 @@ +double('label_cell_margin_top', 4, 3)->after('label2_fields')->default(0)->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('settings', function (Blueprint $table) { + $table->dropColumn('label_cell_margin_top'); + }); + } +}; diff --git a/docker/docker.env b/docker/docker.env index 785da07ee1bd..4ff4b8634a37 100644 --- a/docker/docker.env +++ b/docker/docker.env @@ -1,12 +1,12 @@ # -------------------------------------------- # REQUIRED: BASIC APP SETTINGS # -------------------------------------------- -#APP_ENV=develop -#APP_DEBUG=false -#APP_KEY=Change_this_key_or_snipe_will_get_ya -#APP_URL=http://127.0.0.1:32782 -#APP_TIMEZONE=US/Pacific -#APP_LOCALE=en +APP_ENV=develop +APP_DEBUG=false +APP_KEY=base64:WpNieYLCLW/T+VC63PK0ypfNUZ+/zf0V6eG3XIpCCaY= +APP_URL=http://127.0.0.1:32782 +APP_TIMEZONE=US/Pacific +APP_LOCALE=en # -------------------------------------------- diff --git a/resources/lang/en-US/admin/settings/general.php b/resources/lang/en-US/admin/settings/general.php index d656391edd5a..81b8bb7a25cb 100644 --- a/resources/lang/en-US/admin/settings/general.php +++ b/resources/lang/en-US/admin/settings/general.php @@ -67,6 +67,7 @@ 'favicon' => 'Favicon', 'favicon_format' => 'Accepted filetypes are ico, png, and gif. Other image formats may not work in all browsers.', 'favicon_size' => 'Favicons should be square images, 16x16 pixels.', + 'field_margin_top' => 'Field Margin Top', 'footer_text' => 'Additional Footer Text ', 'footer_text_help' => 'This text will appear in the right-side footer. Links are allowed using Github flavored markdown. Line breaks, headers, images, etc may result in unpredictable results.', 'general_settings' => 'General Settings', @@ -78,6 +79,7 @@ 'info' => 'These settings let you customize certain aspects of your installation.', 'label_logo' => 'Label Logo', 'label_logo_size' => 'Square logos look best - will be displayed in the top right of each asset label. ', + 'label_cell_margin_top_help'=> 'Vertically align the label fields below if needed. Max value 10.', 'laravel' => 'Laravel Version', 'ldap' => 'LDAP', 'ldap_default_group' => 'Default Permissions Group', diff --git a/resources/views/settings/labels.blade.php b/resources/views/settings/labels.blade.php index 33640edbf28a..124d321ecba2 100644 --- a/resources/views/settings/labels.blade.php +++ b/resources/views/settings/labels.blade.php @@ -199,7 +199,7 @@ class="table table-striped snipe-table" -
{{ trans('admin/settings/general.label2_2d_target_help') }}
{{ trans('admin/settings/general.label_cell_margin_top_help') }}
+