feat: ✨ Added AnglePriseVue + NatureFichier + TypeContenu
This commit is contained in:
parent
42faaf51bb
commit
e5d497fa76
14 changed files with 424 additions and 6 deletions
|
|
@ -18,6 +18,7 @@ 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\Article;
|
||||
use App\Models\Copyright;
|
||||
use App\Models\Dossier;
|
||||
|
|
@ -27,11 +28,13 @@ 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;
|
||||
|
|
@ -73,11 +76,14 @@ class MediaController extends Controller
|
|||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Societe> */
|
||||
$societes = Societe::orderBy('libelle')->get();
|
||||
|
||||
$typesmedia = TypeMedia::all();
|
||||
$langues = Langue::all();
|
||||
$copyrights = Copyright::all();
|
||||
$etiquettes = Etiquette::all();
|
||||
$marques = Marque::all();
|
||||
$typesmedia = TypeMedia::all();
|
||||
$langues = Langue::all();
|
||||
$copyrights = Copyright::all();
|
||||
$etiquettes = Etiquette::all();
|
||||
$marques = Marque::all();
|
||||
$naturesfichier = NatureFichier::all();
|
||||
$typescontenu = TypeContenu::all();
|
||||
$anglesprisevue = AnglePriseVue::all();
|
||||
|
||||
/** @var int|null */
|
||||
$dossier_id = $request->d;
|
||||
|
|
@ -122,6 +128,9 @@ class MediaController extends Controller
|
|||
return view('media_manager')->with([
|
||||
'sujets' => $sujets,
|
||||
'typesmedia' => $typesmedia,
|
||||
'naturesfichier' => $naturesfichier,
|
||||
'typescontenu' => $typescontenu,
|
||||
'anglesprisevue' => $anglesprisevue,
|
||||
'langues' => $langues,
|
||||
'copyrights' => $copyrights,
|
||||
'etiquettes' => $etiquettes,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ 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 ?
|
||||
|
|
@ -57,6 +60,9 @@ 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.
|
||||
|
|
|
|||
|
|
@ -217,6 +217,12 @@ class ArcadiaLinkUtilities
|
|||
->appendChild($dom->createCDATASection("$media->copyright_id"));
|
||||
$root->appendChild($dom->createElement('codeVariante'))
|
||||
->appendChild($dom->createCDATASection("$media->variante_id"));
|
||||
$root->appendChild($dom->createElement('codeAnglePriseVue'))
|
||||
->appendChild($dom->createCDATASection($media->angleprisevue->value));
|
||||
$root->appendChild($dom->createElement('codeNatureFichier'))
|
||||
->appendChild($dom->createCDATASection($media->naturefichier->value));
|
||||
$root->appendChild($dom->createElement('codeTypeContenu'))
|
||||
->appendChild($dom->createCDATASection($media->typecontenu->value));
|
||||
$root->appendChild($dom->createElement('dateCreation'))
|
||||
->appendChild($dom->createCDATASection("$media->created_at"));
|
||||
$root->appendChild($dom->createElement('dateModification'))
|
||||
|
|
|
|||
27
app/Models/AnglePriseVue.php
Normal file
27
app/Models/AnglePriseVue.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AnglePriseVue extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'value',
|
||||
'label'
|
||||
];
|
||||
|
||||
// * RELATIONSHIPS
|
||||
|
||||
/**
|
||||
* HasMany variantes relation
|
||||
*
|
||||
* Get the media for the AnglePriseVue.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function mediaList()
|
||||
{
|
||||
return $this->hasMany(Media::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -76,6 +76,9 @@ class Media extends Model
|
|||
'copyright_id',
|
||||
'etiquette_id',
|
||||
'langue_id',
|
||||
'angle_prise_vue_id',
|
||||
'nature_fichier_id',
|
||||
'type_contenu_id',
|
||||
'commentaire',
|
||||
'version',
|
||||
'statut',
|
||||
|
|
@ -461,6 +464,39 @@ class Media extends Model
|
|||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo TypeContenu relation
|
||||
* Get the TypeContenu that belongs to the media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function typecontenu()
|
||||
{
|
||||
return $this->belongsTo(TypeContenu::class, 'type_contenu_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo AnglePriseVue relation
|
||||
* Get the AnglePriseVue that belongs to the media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function angleprisevue()
|
||||
{
|
||||
return $this->belongsTo(AnglePriseVue::class, 'angle_prise_vue_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo NatureFichier relation
|
||||
* Get the NatureFichier that belongs to the media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function naturefichier()
|
||||
{
|
||||
return $this->belongsTo(NatureFichier::class, 'nature_fichier_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* HasMany historiques relation
|
||||
* Get the historiques for the media.
|
||||
|
|
|
|||
27
app/Models/NatureFichier.php
Normal file
27
app/Models/NatureFichier.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class NatureFichier extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'value',
|
||||
'label'
|
||||
];
|
||||
|
||||
// * RELATIONSHIPS
|
||||
|
||||
/**
|
||||
* HasMany variantes relation
|
||||
*
|
||||
* Get the media for the NatureFichier.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function mediaList()
|
||||
{
|
||||
return $this->hasMany(Media::class);
|
||||
}
|
||||
}
|
||||
27
app/Models/TypeContenu.php
Normal file
27
app/Models/TypeContenu.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TypeContenu extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'value',
|
||||
'label'
|
||||
];
|
||||
|
||||
// * RELATIONSHIPS
|
||||
|
||||
/**
|
||||
* HasMany variantes relation
|
||||
*
|
||||
* Get the media for the TypeContenu.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function mediaList()
|
||||
{
|
||||
return $this->hasMany(Media::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
use App\Models\NatureFichier;
|
||||
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::create('nature_fichiers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('value');
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
NatureFichier::query()->create([
|
||||
'value' => 'Undefined',
|
||||
'label' => 'Non défini'
|
||||
]);
|
||||
NatureFichier::query()->create([
|
||||
'value' => 'A',
|
||||
'label' => 'Photographie d\'un produit en definition standard'
|
||||
]);
|
||||
NatureFichier::query()->create([
|
||||
'value' => 'C',
|
||||
'label' => 'Photographie d\'un produit en Haute Definition'
|
||||
]);
|
||||
NatureFichier::query()->create([
|
||||
'value' => 'H',
|
||||
'label' => 'Mobile Ready Hero Image = autre (dessin, illustration, logotype, pictogramme)'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nature_fichiers');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
use App\Models\AnglePriseVue;
|
||||
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::create('angle_prise_vues', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('value');
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
AnglePriseVue::query()->create([
|
||||
'value' => 'Undefined',
|
||||
'label' => 'Non défini'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
'value' => 'C',
|
||||
'label' => 'Centre, angle de plongee 15 degres'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
'value' => 'L',
|
||||
'label' => '3/4 gauche'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
'value' => 'N',
|
||||
'label' => 'Centre, sans angle de plongee'
|
||||
]);
|
||||
AnglePriseVue::query()->create([
|
||||
'value' => 'R',
|
||||
'label' => '3/4 droit'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('angle_prise_vues');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
use App\Models\TypeContenu;
|
||||
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::create('type_contenus', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('value');
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
TypeContenu::query()->create([
|
||||
'value' => 'Undefined',
|
||||
'label' => 'Non défini'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
'value' => 'D',
|
||||
'label' => 'Produit prepare (monte, pour les produits a assembler)'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
'value' => 'G',
|
||||
'label' => 'Mise en situation (produits emballes ou deballes, suggestion de presentation)'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
'value' => '0',
|
||||
'label' => 'Produit nu/deballe'
|
||||
]);
|
||||
TypeContenu::query()->create([
|
||||
'value' => '1',
|
||||
'label' => 'produit emballe/packshot'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('type_contenus');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?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('media', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('angle_prise_vue_id')
|
||||
->after('variante_id')
|
||||
->default(1);
|
||||
$table->foreign('angle_prise_vue_id')
|
||||
->references('id')
|
||||
->on('angle_prise_vues');
|
||||
|
||||
$table->unsignedBigInteger('nature_fichier_id')
|
||||
->after('angle_prise_vue_id')
|
||||
->default(1);
|
||||
$table->foreign('nature_fichier_id')
|
||||
->references('id')
|
||||
->on('nature_fichiers');
|
||||
|
||||
$table->unsignedBigInteger('type_contenu_id')
|
||||
->after('nature_fichier_id')
|
||||
->default(1);
|
||||
$table->foreign('type_contenu_id')
|
||||
->references('id')
|
||||
->on('type_contenus');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'angle_prise_vue_id',
|
||||
'nature_fichier_id',
|
||||
'type_contenu_id',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -89,6 +89,9 @@
|
|||
:marques="marques"
|
||||
:etiquettes="etiquettes"
|
||||
:copyrights="copyrights"
|
||||
:naturesfichier="naturesfichier"
|
||||
:typescontenu="typescontenu"
|
||||
:anglesprisevue="anglesprisevue"
|
||||
@closeEdit="close"
|
||||
/>
|
||||
<MeLinksComponent :currentTab="currentTab" />
|
||||
|
|
@ -125,6 +128,10 @@ export default {
|
|||
this.marques = data.marques;
|
||||
this.etiquettes = data.etiquettes;
|
||||
this.copyrights = data.copyrights;
|
||||
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",
|
||||
|
|
@ -163,6 +170,9 @@ export default {
|
|||
marques: [],
|
||||
etiquettes: [],
|
||||
copyrights: [],
|
||||
naturesfichier: [],
|
||||
typescontenu: [],
|
||||
anglesprisevue: [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
|
|||
|
|
@ -98,6 +98,57 @@
|
|||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Nature du fichier <span>*</span></label>
|
||||
<select
|
||||
id="naturefichier"
|
||||
name="naturefichier"
|
||||
required
|
||||
v-model="oMedia.nature_fichier_id"
|
||||
:disabled="oMedia.isLocked || oMedia.arcadia_id !== null"
|
||||
>
|
||||
<option :value="null" selected disabled>
|
||||
Sélectionnez une nature de fichier
|
||||
</option>
|
||||
<option v-for="item in naturesfichier" :value="item.id">
|
||||
{{ item.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Type de contenu <span>*</span></label>
|
||||
<select
|
||||
id="typecontenu"
|
||||
name="typecontenu"
|
||||
required
|
||||
v-model="oMedia.type_contenu_id"
|
||||
:disabled="oMedia.isLocked || oMedia.arcadia_id !== null"
|
||||
>
|
||||
<option :value="null" selected disabled>
|
||||
Sélectionnez un type de contenu
|
||||
</option>
|
||||
<option v-for="item in typescontenu" :value="item.id">
|
||||
{{ item.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Angle prise de vue <span>*</span></label>
|
||||
<select
|
||||
id="angleprisevue"
|
||||
name="angleprisevue"
|
||||
required
|
||||
v-model="oMedia.angle_prise_vue_id"
|
||||
:disabled="oMedia.isLocked || oMedia.arcadia_id !== null"
|
||||
>
|
||||
<option :value="null" selected disabled>
|
||||
Sélectionnez un type de contenu
|
||||
</option>
|
||||
<option v-for="item in anglesprisevue" :value="item.id">
|
||||
{{ item.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Langue <span>*</span></label>
|
||||
<select
|
||||
|
|
@ -380,7 +431,7 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|||
export default {
|
||||
name: "MeEditComponent",
|
||||
components: { FontAwesomeIcon },
|
||||
props: ["currentTab", "langues", "societes", "marques", "etiquettes", "copyrights"],
|
||||
props: ["currentTab", "langues", "societes", "marques", "etiquettes", "copyrights", "naturesfichier", "typescontenu", "anglesprisevue"],
|
||||
computed: {
|
||||
storeMedia() {
|
||||
return this.$store.state.media;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
'marques' => $marques,
|
||||
'etiquettes' => $etiquettes,
|
||||
'copyrights' => $copyrights,
|
||||
'naturesfichier' => $naturesfichier,
|
||||
'typescontenu' => $typescontenu,
|
||||
'anglesprisevue' => $anglesprisevue,
|
||||
];
|
||||
if(session('autoOpen')) {
|
||||
$dataVue['open'] = session('autoOpen');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue