Remove unused fields from shop

This commit is contained in:
Jérémy Munsch 2023-02-21 09:39:46 +01:00
parent 7ad3ee9f2e
commit 2b09eae3e1
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
4 changed files with 44 additions and 82 deletions

View file

@ -37,14 +37,6 @@ class StoreShopRequest extends FormRequest
'numeric',
new EnumIsValidRule(Country::class),
'in:' . Country::france()->value
],
'latitude' => [
'required',
'regex:/^([0-8]?\d)°([0-5]?\d)\'([0-5]?\d\.\d)"(N|S)$/i'
],
'longitude' => [
'required',
'regex:/^([0-1]?[0-8]\d|\d?\d)°([0-5]?\d)\'([0-5]?\d\.\d)"(E|W|O)$/i'
]
];
}
@ -62,23 +54,7 @@ class StoreShopRequest extends FormRequest
'postal_code' => trans('code postal'),
'city' => trans('ville'),
'country' => trans('pays'),
'latitude' => trans('latitude'),
'longitude' => trans('longitude'),
'gmaps_placeid' => trans('Map place ID'),
'gmaps_link_href' => trans('Lien direct'),
'gmaps_embed_href' => trans('Embed href'),
];
}
/**
* Get custom messages for validator errors.
* @return array
*/
public function messages()
{
return [
'latitude.between' => trans('Vous devez renseigner ":attribute" avec le format degrés minutes secondes'),
'longitude.between' => trans('Vous devez renseigner ":attribute" avec le format degrés minutes secondes'),
];
}
}

View file

@ -59,10 +59,6 @@ class Shop extends Model
'city',
'country',
'phone',
'latitude',
'longitude',
'gmaps_placeid',
'gmaps_link_href',
'gmaps_embed_href',
];

View file

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveUnusedShopsParameters extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('shops', function (Blueprint $table) {
$table->dropColumn('latitude');
$table->dropColumn('longitude');
$table->dropColumn('gmaps_embed_href');
$table->dropColumn('gmaps_placeid');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('shops', function (Blueprint $table) {
$table->double('latitude')->after('phone_country')->nullable()
->comment('Coordonnée latitude décimale');
$table->double('longitude')->after('latitude')->nullable()
->comment('Coordonnée longitude décimale');
$table->string('gmaps_embed_href', 350)->after('gmaps_link_href')->nullable()
->comment('Lien direct de la société sur google maps pour être utilisé dans une iframe.');
$table->string('gmaps_placeid', 100)->after('gmaps_embed_href')->nullable()
->comment(
'Google maps place ID style : ChIJMarzFNKI4kcRf-B9akxdAmk, nécessite une clé d\'api'
);
});
}
}

View file

@ -93,38 +93,6 @@
</div>
</div>
<div class="row">
<div class="col">
<fieldset class="border p-3 mb-3">
<legend>{{ __('Coordonnées GPS') }}</legend>
<div class="row mb-3">
<div class="col-12 col-md-6">
@include('back::partials.inputs.varchar', [
'id' => 'shopLatitude',
'label' => __('Latitude'),
'name' => 'latitude',
'required' => true,
'model' => $shopModel ?? null,
'placeholder' => __('ex : 8°09\'53.4"N'),
'helper' => __('Latitude en Degré ° Minutes \' Secondes " N(ord) ou S(ud)'),
])
</div>
<div class="col-12 col-md-6">
@include('back::partials.inputs.varchar', [
'id' => 'shopLongitude',
'label' => __('Longitude'),
'name' => 'longitude',
'required' => true,
'model' => $shopModel ?? null,
'placeholder' => __('ex : 122°30\'07.1"E'),
'helper' => __('Longitude en Degré ° Minutes \' Secondes " E(st) ou O(uest)'),
])
</div>
</div>
</fieldset>
</div>
</div>
<hr>
<div class="row">
@ -143,28 +111,6 @@
'helper' => __('Url cible pour les iframes.')
])
</div>
<div class="col">
@include('back::partials.inputs.varchar', [
'id' => 'shopLinkHref',
'label' => __('Lien direct'),
'name' => 'gmaps_link_href',
'model' => $shopModel ?? null,
'required' => true,
'placeholder' => __('https://goo.gl/maps/Q8VL1B3Wxy...'),
'helper' => __('Url vers google maps')
])
</div>
<div class="col">
@include('back::partials.inputs.varchar', [
'id' => 'shopPlaceId',
'label' => __('Map place ID'),
'name' => 'gmaps_placeid',
'model' => $shopModel ?? null,
'required' => true,
'placeholder' => __('ChIJMarzFNKI4kcRf-B9ak...'),
'helper' => __('Google map place ID (necessite une clé d\'API)".')
])
</div>
</div>
</fieldset>
</div>