Skip to content

Commit

Permalink
Added liability form property and checkbox
Browse files Browse the repository at this point in the history
# Conflicts:
#	lang/de.json
#	resources/js/vue-i18n-locales.generated.js
  • Loading branch information
mrcage authored and usp-npe committed Sep 4, 2022
1 parent b7e058b commit 05fae44
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/Exports/Visitors/Sheets/VisitorCheckInsExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function headings(): array
__('Nationality'),
__('Date of birth'),
__('Living situation'),
__('Liability form signed'),
__('Purpose of visit'),
];
}
Expand All @@ -55,6 +56,7 @@ public function map($checkin): array
$checkin->visitor->nationality,
optional($checkin->visitor->date_of_birth)->toDateString(),
$checkin->visitor->living_situation,
$checkin->visitor->liability_form_signed,
$checkin->purpose_of_visit,
];
}
Expand Down
2 changes: 2 additions & 0 deletions app/Exports/Visitors/Sheets/VisitorDataExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function headings(): array
__('Nationality'),
__('Date of birth'),
__('Living situation'),
__('Liability form signed'),
__('Registered'),
__('Check-ins'),
];
Expand All @@ -55,6 +56,7 @@ public function map($visitor): array
$visitor->nationality,
optional($visitor->date_of_birth)->toDateString(),
$visitor->living_situation,
$visitor->liability_form_signed,
$visitor->created_at->format('Y-m-d'),
$visitor->checkins->count(),
];
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Requests/Visitors/StoreVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function rules()
'anonymized' => [
'boolean',
],
'liability_form_signed' => [
'boolean',
],
];
}
}
1 change: 1 addition & 0 deletions app/Http/Resources/Visitors/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function toArray($request)
'date_of_birth' => optional($this->date_of_birth)->toDateString(),
'living_situation' => $this->living_situation,
'anonymized' => $this->anonymized,
'liability_form_signed' => $this->liability_form_signed,
'checked_in_today' => $this->whenLoaded('checkins', fn () => $this->checkins->contains(fn ($checkin) => $checkin->created_at->isToday())),
];
}
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Visitors/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Visitor extends Model
'nationality',
'living_situation',
'anonymized',
'liability_form_signed',
];

protected $nullable = [
Expand All @@ -37,6 +38,7 @@ class Visitor extends Model

protected $casts = [
'anonymized' => 'boolean',
'liability_form_signed' => 'boolean',
];

public function checkins()
Expand Down
1 change: 1 addition & 0 deletions database/factories/Visitors/VisitorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function definition()
'date_of_birth' => $this->faker->dateTimeBetween('-50 years', '-1 month'),
'nationality' => $this->faker->optional(0.95)->country,
'living_situation' => $this->faker->optional(0.6)->city,
'liability_form_signed' => $this->faker->boolean(0.2),
// 'purpose_of_visit' => $this->faker->bs,
];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddLiabilityFormSignedToVisitorsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('visitors', function (Blueprint $table) {
$table->boolean('liability_form_signed')->default(false);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('visitors', function (Blueprint $table) {
$table->dropColumn('liability_form_signed');
});
}
}
6 changes: 5 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -782,5 +782,9 @@
"Account Deletion": "Accountlöschung",
"Enable Two-Factor Authentication": "Zwei-Faktor-Authentifizierung aktivieren",
"Disable Two-Factor Authentication": "Zwei-Faktor-Authentifizierung deaktivieren",
"Service": "Dienst"
"Service": "Dienst",
"Edit metadata": "Metadaten bearbeiten",
"Liability form": "Haftungsformular",
"Liability form signed": "Haftungsformular unterschrieben",
"Not signed!": "Nicht signiert!"
}
8 changes: 8 additions & 0 deletions resources/js/components/visitors/VisitorDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
{{ visitor.living_situation }}
</dd>
</template>
<template v-if="!visitor.liability_form_signed">
<dt class="col-sm-4">
{{ $t("Liability form") }}
</dt>
<dd class="col-sm-8">
<span class="text-danger"><font-awesome-icon icon="times"/> {{ $t('Not signed!') }}</span>
</dd>
</template>
</dl>
</template>

Expand Down
6 changes: 6 additions & 0 deletions resources/js/components/visitors/VisitorForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
/></b-form-group>
</b-col>
</b-form-row>
<p>
<b-form-checkbox v-model="formData.liability_form_signed">
{{ $t("Liability form signed") }}
</b-form-checkbox>
</p>
<div class="d-flex justify-content-between align-items-start">
<span>
<b-button
Expand Down Expand Up @@ -173,6 +178,7 @@ export default {
date_of_birth: search && searchType == "date" ? search : "",
nationality: "",
living_situation: "",
liability_form_signed: false
},
genders: [
{ value: "male", text: this.$t("male") },
Expand Down

0 comments on commit 05fae44

Please sign in to comment.