fix: 🐛 prefix new tables with arcadia_ + added a condition to edit new columns only when subject === 1
This commit is contained in:
parent
e5d497fa76
commit
a0c2cd8db6
13 changed files with 89 additions and 83 deletions
|
|
@ -18,7 +18,9 @@ use App\Http\Requests\Bo\LoadMediaRequest;
|
|||
use App\Http\Requests\Bo\ShowInterfaceRequest;
|
||||
use App\Lib\ArcadiaLinkUtilities;
|
||||
use App\Lib\ToolboxHelper;
|
||||
use App\Models\AnglePriseVue;
|
||||
use App\Models\ArcadiaAnglePriseVue;
|
||||
use App\Models\ArcadiaNatureFichier;
|
||||
use App\Models\ArcadiaTypeContenu;
|
||||
use App\Models\Article;
|
||||
use App\Models\Copyright;
|
||||
use App\Models\Dossier;
|
||||
|
|
@ -28,13 +30,11 @@ use App\Models\Historique;
|
|||
use App\Models\Langue;
|
||||
use App\Models\Marque;
|
||||
use App\Models\Media;
|
||||
use App\Models\NatureFichier;
|
||||
use App\Models\Recherche;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Societe;
|
||||
use App\Models\Sujet;
|
||||
use App\Models\Tag;
|
||||
use App\Models\TypeContenu;
|
||||
use App\Models\TypeMedia;
|
||||
use App\Traits\Http\HandlesMedia;
|
||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||
|
|
@ -81,9 +81,9 @@ class MediaController extends Controller
|
|||
$copyrights = Copyright::all();
|
||||
$etiquettes = Etiquette::all();
|
||||
$marques = Marque::all();
|
||||
$naturesfichier = NatureFichier::all();
|
||||
$typescontenu = TypeContenu::all();
|
||||
$anglesprisevue = AnglePriseVue::all();
|
||||
$naturesfichier = ArcadiaNatureFichier::all();
|
||||
$typescontenu = ArcadiaTypeContenu::all();
|
||||
$anglesprisevue = ArcadiaAnglePriseVue::all();
|
||||
|
||||
/** @var int|null */
|
||||
$dossier_id = $request->d;
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ class UpdateMediaRequest extends FormRequest
|
|||
'type_vue_id' => 'required|exists:type_vues,codeTypevue',
|
||||
'variante_id' => 'required|exists:variantes,codeVariante',
|
||||
'langue_id' => 'required|exists:langues,langue_id',
|
||||
'angle_prise_vue_id' => 'required|exists:angle_prise_vues,id',
|
||||
'nature_fichier_id' => 'required|exists:nature_fichiers,id',
|
||||
'type_contenu_id' => 'required|exists:type_contenus,id',
|
||||
];
|
||||
|
||||
// ? Est lié à arcadia ?
|
||||
|
|
@ -60,16 +57,17 @@ class UpdateMediaRequest extends FormRequest
|
|||
unset($rules['type_vue_id']);
|
||||
unset($rules['variante_id']);
|
||||
unset($rules['langue_id']);
|
||||
unset($rules['angle_prise_vue_id']);
|
||||
unset($rules['nature_fichier_id']);
|
||||
unset($rules['type_contenu_id']);
|
||||
}
|
||||
|
||||
// Article.
|
||||
if ($this->sujet_id == 1) {
|
||||
$rules['articles'] = 'present|array|min:0';
|
||||
$rules['articles.*'] = 'array';
|
||||
$rules['articles.*.id'] = 'exists:articles,id';
|
||||
$rules['articles'] = 'present|array|min:0';
|
||||
$rules['articles.*'] = 'array';
|
||||
$rules['articles.*.id'] = 'exists:articles,id';
|
||||
$rules['arcadia_angle_prise_vue_id'] = 'required|exists:arcadia_angle_prise_vues,id';
|
||||
$rules['arcadia_nature_fichier_id'] = 'required|exists:arcadia_nature_fichiers,id';
|
||||
$rules['arcadia_type_contenu_id'] = 'required|exists:arcadia_type_contenus,id';
|
||||
|
||||
}
|
||||
// Marque.
|
||||
if ($this->sujet_id == 2) {
|
||||
|
|
|
|||
|
|
@ -218,11 +218,11 @@ class ArcadiaLinkUtilities
|
|||
$root->appendChild($dom->createElement('codeVariante'))
|
||||
->appendChild($dom->createCDATASection("$media->variante_id"));
|
||||
$root->appendChild($dom->createElement('codeAnglePriseVue'))
|
||||
->appendChild($dom->createCDATASection($media->angleprisevue->value));
|
||||
->appendChild($dom->createCDATASection($media->arcadiaAngleprisevue->value));
|
||||
$root->appendChild($dom->createElement('codeNatureFichier'))
|
||||
->appendChild($dom->createCDATASection($media->naturefichier->value));
|
||||
->appendChild($dom->createCDATASection($media->arcadiaNaturefichier->value));
|
||||
$root->appendChild($dom->createElement('codeTypeContenu'))
|
||||
->appendChild($dom->createCDATASection($media->typecontenu->value));
|
||||
->appendChild($dom->createCDATASection($media->arcadiaTypecontenu->value));
|
||||
$root->appendChild($dom->createElement('dateCreation'))
|
||||
->appendChild($dom->createCDATASection("$media->created_at"));
|
||||
$root->appendChild($dom->createElement('dateModification'))
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class NatureFichier extends Model
|
||||
class ArcadiaAnglePriseVue extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'value',
|
||||
|
|
@ -16,7 +16,7 @@ class NatureFichier extends Model
|
|||
/**
|
||||
* HasMany variantes relation
|
||||
*
|
||||
* Get the media for the NatureFichier.
|
||||
* Get the media for the ArcadiaAnglePriseVue.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
|
@ -4,7 +4,7 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TypeContenu extends Model
|
||||
class ArcadiaNatureFichier extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'value',
|
||||
|
|
@ -16,7 +16,7 @@ class TypeContenu extends Model
|
|||
/**
|
||||
* HasMany variantes relation
|
||||
*
|
||||
* Get the media for the TypeContenu.
|
||||
* Get the media for the ArcadiaNatureFichier.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
|
@ -4,7 +4,7 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AnglePriseVue extends Model
|
||||
class ArcadiaTypeContenu extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'value',
|
||||
|
|
@ -16,7 +16,7 @@ class AnglePriseVue extends Model
|
|||
/**
|
||||
* HasMany variantes relation
|
||||
*
|
||||
* Get the media for the AnglePriseVue.
|
||||
* Get the media for the ArcadiaTypeContenu.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
|
@ -76,9 +76,9 @@ class Media extends Model
|
|||
'copyright_id',
|
||||
'etiquette_id',
|
||||
'langue_id',
|
||||
'angle_prise_vue_id',
|
||||
'nature_fichier_id',
|
||||
'type_contenu_id',
|
||||
'arcadia_angle_prise_vue_id',
|
||||
'arcadia_nature_fichier_id',
|
||||
'arcadia_type_contenu_id',
|
||||
'commentaire',
|
||||
'version',
|
||||
'statut',
|
||||
|
|
@ -465,36 +465,36 @@ class Media extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* BelongsTo TypeContenu relation
|
||||
* Get the TypeContenu that belongs to the media.
|
||||
* BelongsTo ArcadiaTypeContenu relation
|
||||
* Get the ArcadiaTypeContenu that belongs to the media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function typecontenu()
|
||||
public function arcadiaTypecontenu()
|
||||
{
|
||||
return $this->belongsTo(TypeContenu::class, 'type_contenu_id');
|
||||
return $this->belongsTo(ArcadiaTypeContenu::class, 'arcadia_type_contenu_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo AnglePriseVue relation
|
||||
* Get the AnglePriseVue that belongs to the media.
|
||||
* BelongsTo ArcadiaAnglePriseVue relation
|
||||
* Get the ArcadiaAnglePriseVue that belongs to the media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function angleprisevue()
|
||||
public function arcadiaAngleprisevue()
|
||||
{
|
||||
return $this->belongsTo(AnglePriseVue::class, 'angle_prise_vue_id');
|
||||
return $this->belongsTo(ArcadiaAnglePriseVue::class, 'arcadia_angle_prise_vue_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo NatureFichier relation
|
||||
* Get the NatureFichier that belongs to the media.
|
||||
* BelongsTo ArcadiaNatureFichier relation
|
||||
* Get the ArcadiaNatureFichier that belongs to the media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function naturefichier()
|
||||
public function arcadiaNaturefichier()
|
||||
{
|
||||
return $this->belongsTo(NatureFichier::class, 'nature_fichier_id');
|
||||
return $this->belongsTo(ArcadiaNatureFichier::class, 'arcadia_nature_fichier_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Models\NatureFichier;
|
||||
use App\Models\ArcadiaNatureFichier;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
@ -14,26 +14,26 @@ return new class extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nature_fichiers', function (Blueprint $table) {
|
||||
Schema::create('arcadia_nature_fichiers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('value');
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
NatureFichier::query()->create([
|
||||
ArcadiaNatureFichier::query()->create([
|
||||
'value' => 'Undefined',
|
||||
'label' => 'Non défini'
|
||||
]);
|
||||
NatureFichier::query()->create([
|
||||
ArcadiaNatureFichier::query()->create([
|
||||
'value' => 'A',
|
||||
'label' => 'Photographie d\'un produit en definition standard'
|
||||
]);
|
||||
NatureFichier::query()->create([
|
||||
ArcadiaNatureFichier::query()->create([
|
||||
'value' => 'C',
|
||||
'label' => 'Photographie d\'un produit en Haute Definition'
|
||||
]);
|
||||
NatureFichier::query()->create([
|
||||
ArcadiaNatureFichier::query()->create([
|
||||
'value' => 'H',
|
||||
'label' => 'Mobile Ready Hero Image = autre (dessin, illustration, logotype, pictogramme)'
|
||||
]);
|
||||
|
|
@ -46,6 +46,6 @@ return new class extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nature_fichiers');
|
||||
Schema::dropIfExists('arcadia_nature_fichiers');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Models\AnglePriseVue;
|
||||
use App\Models\ArcadiaAnglePriseVue;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
@ -14,30 +14,30 @@ return new class extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('angle_prise_vues', function (Blueprint $table) {
|
||||
Schema::create('arcadia_angle_prise_vues', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('value');
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
AnglePriseVue::query()->create([
|
||||
ArcadiaAnglePriseVue::query()->create([
|
||||
'value' => 'Undefined',
|
||||
'label' => 'Non défini'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
ArcadiaAnglePriseVue::query()->create([
|
||||
'value' => 'C',
|
||||
'label' => 'Centre, angle de plongee 15 degres'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
ArcadiaAnglePriseVue::query()->create([
|
||||
'value' => 'L',
|
||||
'label' => '3/4 gauche'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
ArcadiaAnglePriseVue::query()->create([
|
||||
'value' => 'N',
|
||||
'label' => 'Centre, sans angle de plongee'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
ArcadiaAnglePriseVue::query()->create([
|
||||
'value' => 'R',
|
||||
'label' => '3/4 droit'
|
||||
]);
|
||||
|
|
@ -50,6 +50,6 @@ return new class extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('angle_prise_vues');
|
||||
Schema::dropIfExists('arcadia_angle_prise_vues');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Models\TypeContenu;
|
||||
use App\Models\ArcadiaTypeContenu;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
@ -14,30 +14,30 @@ return new class extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('type_contenus', function (Blueprint $table) {
|
||||
Schema::create('arcadia_type_contenus', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('value');
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
TypeContenu::query()->create([
|
||||
ArcadiaTypeContenu::query()->create([
|
||||
'value' => 'Undefined',
|
||||
'label' => 'Non défini'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
ArcadiaTypeContenu::query()->create([
|
||||
'value' => 'D',
|
||||
'label' => 'Produit prepare (monte, pour les produits a assembler)'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
ArcadiaTypeContenu::query()->create([
|
||||
'value' => 'G',
|
||||
'label' => 'Mise en situation (produits emballes ou deballes, suggestion de presentation)'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
ArcadiaTypeContenu::query()->create([
|
||||
'value' => '0',
|
||||
'label' => 'Produit nu/deballe'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
ArcadiaTypeContenu::query()->create([
|
||||
'value' => '1',
|
||||
'label' => 'produit emballe/packshot'
|
||||
]);
|
||||
|
|
@ -50,6 +50,6 @@ return new class extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('type_contenus');
|
||||
Schema::dropIfExists('arcadia_type_contenus');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,26 +14,26 @@ return new class extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('angle_prise_vue_id')
|
||||
$table->unsignedBigInteger('arcadia_angle_prise_vue_id')
|
||||
->after('variante_id')
|
||||
->default(1);
|
||||
$table->foreign('angle_prise_vue_id')
|
||||
$table->foreign('arcadia_angle_prise_vue_id')
|
||||
->references('id')
|
||||
->on('angle_prise_vues');
|
||||
->on('arcadia_angle_prise_vues');
|
||||
|
||||
$table->unsignedBigInteger('nature_fichier_id')
|
||||
->after('angle_prise_vue_id')
|
||||
$table->unsignedBigInteger('arcadia_nature_fichier_id')
|
||||
->after('arcadia_angle_prise_vue_id')
|
||||
->default(1);
|
||||
$table->foreign('nature_fichier_id')
|
||||
$table->foreign('arcadia_nature_fichier_id')
|
||||
->references('id')
|
||||
->on('nature_fichiers');
|
||||
->on('arcadia_nature_fichiers');
|
||||
|
||||
$table->unsignedBigInteger('type_contenu_id')
|
||||
->after('nature_fichier_id')
|
||||
$table->unsignedBigInteger('arcadia_type_contenu_id')
|
||||
->after('arcadia_nature_fichier_id')
|
||||
->default(1);
|
||||
$table->foreign('type_contenu_id')
|
||||
$table->foreign('arcadia_type_contenu_id')
|
||||
->references('id')
|
||||
->on('type_contenus');
|
||||
->on('arcadia_type_contenus');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -46,9 +46,9 @@ return new class extends Migration
|
|||
{
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'angle_prise_vue_id',
|
||||
'nature_fichier_id',
|
||||
'type_contenu_id',
|
||||
'arcadia_angle_prise_vue_id',
|
||||
'arcadia_nature_fichier_id',
|
||||
'arcadia_type_contenu_id',
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ export default {
|
|||
this.naturesfichier = data.naturesfichier;
|
||||
this.typescontenu = data.typescontenu;
|
||||
this.anglesprisevue = data.anglesprisevue;
|
||||
console.log("MmEditComponent - naturesfichier : ", data.naturesfichier);
|
||||
if (this.open !== undefined) {
|
||||
this.$store.commit({
|
||||
type: "updateMedia",
|
||||
|
|
|
|||
|
|
@ -98,13 +98,16 @@
|
|||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div
|
||||
class="row"
|
||||
v-if="this.oMedia.sujet_id === 1"
|
||||
>
|
||||
<label>Nature du fichier <span>*</span></label>
|
||||
<select
|
||||
id="naturefichier"
|
||||
name="naturefichier"
|
||||
required
|
||||
v-model="oMedia.nature_fichier_id"
|
||||
v-model="oMedia.arcadia_nature_fichier_id"
|
||||
:disabled="oMedia.isLocked || oMedia.arcadia_id !== null"
|
||||
>
|
||||
<option :value="null" selected disabled>
|
||||
|
|
@ -115,13 +118,16 @@
|
|||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div
|
||||
class="row"
|
||||
v-if="this.oMedia.sujet_id === 1"
|
||||
>
|
||||
<label>Type de contenu <span>*</span></label>
|
||||
<select
|
||||
id="typecontenu"
|
||||
name="typecontenu"
|
||||
required
|
||||
v-model="oMedia.type_contenu_id"
|
||||
v-model="oMedia.arcadia_type_contenu_id"
|
||||
:disabled="oMedia.isLocked || oMedia.arcadia_id !== null"
|
||||
>
|
||||
<option :value="null" selected disabled>
|
||||
|
|
@ -132,13 +138,16 @@
|
|||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div
|
||||
class="row"
|
||||
v-if="this.oMedia.sujet_id === 1"
|
||||
>
|
||||
<label>Angle prise de vue <span>*</span></label>
|
||||
<select
|
||||
id="angleprisevue"
|
||||
name="angleprisevue"
|
||||
required
|
||||
v-model="oMedia.angle_prise_vue_id"
|
||||
v-model="oMedia.arcadia_angle_prise_vue_id"
|
||||
:disabled="oMedia.isLocked || oMedia.arcadia_id !== null"
|
||||
>
|
||||
<option :value="null" selected disabled>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue