Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make service summary and details fields, add global formatters, display a modal work item details #10

Merged
merged 9 commits into from
Aug 27, 2022
Prev Previous commit
Next Next commit
rename services to service_summary
  • Loading branch information
dlopez0882 committed Aug 26, 2022
commit d8211dfa4ac8192cf3f7cdb010acd18689631402
2 changes: 1 addition & 1 deletion app/Http/Controllers/WorkItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function store(Request $request)
'service_date' => $request->workItemProps['date'],
'vehicle_id' => $request->workItemProps['vehicle_id'],
'mileage' => $request->workItemProps['mileage'],
'services' => $request->workItemProps['services'],
'service_summary' => $request->workItemProps['service_summary'],
'technician' => $request->workItemProps['technician'],
'cost' => $request->workItemProps['cost'],
]);
Expand Down
2 changes: 1 addition & 1 deletion app/Models/WorkItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WorkItems extends Model
'service_date',
'vehicle_id',
'mileage',
'services',
'service_summary',
'cost',
'technician',
];
Expand Down
32 changes: 32 additions & 0 deletions database/migrations/2022_08_26_224010_rename_services_column.php
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;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('work_items', function (Blueprint $table) {
$table->renameColumn('services', 'service_summary');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('work_items', function (Blueprint $table) {
$table->renameColumn('service_summary', 'services');
});
}
};
12 changes: 6 additions & 6 deletions resources/js/components/AddWorkItemModalComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
vehicleid: "",
date: "",
mileage: "",
services: "",
service_summary: "",
technician: "",
cost: ""
}
Expand All @@ -25,7 +25,7 @@
return {
date: { required },
mileage: { required },
services: { required },
service_summary: { required },
technician: { required },
cost: { required }
}
Expand All @@ -43,7 +43,7 @@
vehicle_id: this.$attrs.data.vehicleid,
date: this.$refs.date.value,
mileage: this.$refs.mileage.value,
services: this.$refs.services.value,
service_summary: this.$refs.service_summary.value,
technician: this.$refs.technician.value,
cost: this.$refs.cost.value
}
Expand Down Expand Up @@ -98,9 +98,9 @@
</div>

<div class="mb-3">
<label for="services">Service item(s)</label>
<input type="text" name="services" id="services" class="form-control" v-model="services" ref="services">
<div class="text-danger" v-if="v$.services.$error">Service item(s) field is required.</div>
<label for="service_summary">Service summary</label>
<input type="text" name="service_summary" id="service_summary" class="form-control" v-model="service_summary" ref="service_summary">
<div class="text-danger" v-if="v$.service_summary.$error">Service summary field is required.</div>
</div>

<div class="mb-3">
Expand Down
4 changes: 2 additions & 2 deletions resources/views/vehicles/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<thead>
<th>Date</th>
<th>Mileage</th>
<th>Service item(s)</th>
<th>Service summary</th>
<th class="d-none d-md-table-cell">Performed by</th>
<th class="d-none d-md-table-cell">Cost</th>
<th>&nbsp;</th>
Expand All @@ -35,7 +35,7 @@
</td>
<td class="table-text">
{{-- formatted to render html --}}
<div>{!! $workOrder->services !!}</div>
<div>{!! $workOrder->service_summary !!}</div>
</td>
<td class="table-text d-none d-md-table-cell">
{{ $workOrder->technician }}
Expand Down