Skip to content

Commit

Permalink
fix display edited county && projects categories
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Oct 16, 2023
1 parent e7fad7c commit 5cfa91d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class ProjectsRelationManager extends RelationManager

protected static ?string $recordTitleAttribute = 'name';


public static function getTitle(): string
{
return __('project.label.plural');
Expand Down
7 changes: 1 addition & 6 deletions resources/js/Components/Field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@
</template>

<script setup>
import {computed, onMounted} from "vue";
onMounted(() => {
console.log('mounted')
console.log(props.errors)
});
import {computed} from "vue";
const props = defineProps({
label: String,
hasPendingChanges: {
Expand Down
29 changes: 16 additions & 13 deletions resources/js/Pages/AdminOng/Projects/EditProject.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<template>
<DashboardLayout>
<Title :title="$t('edit_project_title')" />

<SecondaryButton

v-if="!project.is_active && !project.is_pending && !project.can_be_archived"
class="w-full mt-4 py-2.5 text-primary-500 ring-1 ring-inset ring-primary-500 hover:bg-primary-400"
@click="changeProjectStatus(project.id, 'pending', project.type)"
:label="$t('publish')"
/>
<dl class="mt-6 border-t border-gray-100 divide-y divide-gray-100">
<!-- Edit project name -->
<Field :label="$t('project_name_label')" :hasPendingChanges="changes.includes('name')" alt :errors="formChangeStatus.errors.name">
Expand Down Expand Up @@ -112,7 +104,7 @@
<!-- Edit project category -->
<Field :label="$t('project_category_label')" :hasPendingChanges="changes.includes('categories')" :errors="formChangeStatus.errors.categories">
<template #value>
{{ project.categories_names }}
{{ originalProject.categories_names }}
</template>

<template #action>
Expand All @@ -135,7 +127,8 @@
<!-- Edit project county -->
<Field :label="$t('counties_label')" :hasPendingChanges="changes.includes('counties')" :errors="formChangeStatus.errors.counties">
<template #value>
{{ project.counties_names}}
{{ originalProject.counties_names}}

</template>

<template #action>
Expand All @@ -145,7 +138,7 @@
class="flex justify-end col-span-1"
>
<Select
:label="$t('project_category_label')"
:label="$t('counties_label')"
type="singleValue"
:options="props.counties"
v-model="project.counties"
Expand Down Expand Up @@ -403,6 +396,12 @@
</div>
</dl>
</div>
<SecondaryButton
v-if="!project.is_active && !project.is_pending && !project.can_be_archived"
class="w-full mt-4 py-2.5 text-primary-500 ring-1 ring-inset ring-primary-500 hover:bg-primary-400"
@click="changeProjectStatus(project.id, 'pending', project.type)"
:label="$t('publish')"
/>
</DashboardLayout>
</template>

Expand Down Expand Up @@ -438,8 +437,6 @@
const project = ref(props.project);
const originalProject = computed(() => props.project);
console.log(props.projectCategories, props.counties);
const resetField = (field) => {
project.value[field] = originalProject.value[field];
};
Expand All @@ -462,6 +459,12 @@
[field]: project.value[field],
});
// if (field ==='counties') {
// console.log(props.counties.find(form.counties));
// project.counties_names = props.counties.find(form.counties);
// }
// console.log(form,field);
form.post(route('dashboard.projects.update', project.value.id), {
preserveScroll: true,
onSuccess: (response) => {
Expand Down

0 comments on commit 5cfa91d

Please sign in to comment.