Przeglądaj źródła

feat(units): finaliza tab de history e medias

ebagabee 3 tygodni temu
rodzic
commit
06768f41ae
2 zmienionych plików z 304 dodań i 2 usunięć
  1. 149 1
      src/pages/unit/tabs/HistoryTab.vue
  2. 155 1
      src/pages/unit/tabs/MediasTab.vue

+ 149 - 1
src/pages/unit/tabs/HistoryTab.vue

@@ -1,3 +1,151 @@
 <template>
-  <h1>Histórico</h1>
+  <div class="q-pa-md">
+    <div class="row q-col-gutter-md">
+      <div class="col-12 col-md-5">
+        <q-table
+          :rows="history"
+          :columns="columns"
+          row-key="title"
+          flat
+          hide-bottom
+          class="bg-transparent"
+          :row-class="
+            (_, index) =>
+              index === selectedIndex
+                ? 'history-item-active cursor-pointer'
+                : 'cursor-pointer'
+          "
+          @row-click="(_, __, index) => (selectedIndex = index)"
+        >
+          <template #body-cell-actions>
+            <q-td align="center">
+              <div class="flex items-center justify-center q-gutter-x-xs">
+                <q-icon
+                  name="mdi-file-edit-outline"
+                  size="sm"
+                  color="grey-8"
+                  class="cursor-pointer"
+                  style="
+                    border: 1px solid #c9c9c9;
+                    border-radius: 8px;
+                    padding: 4px;
+                  "
+                  @click.stop="console.log('edit')"
+                />
+                <q-icon
+                  name="mdi-trash-can-outline"
+                  size="sm"
+                  color="grey-8"
+                  class="cursor-pointer"
+                  style="
+                    border: 1px solid #c9c9c9;
+                    border-radius: 8px;
+                    padding: 4px;
+                  "
+                  @click.stop="console.log('trash')"
+                />
+              </div>
+            </q-td>
+          </template>
+
+          <template #body-cell-franchisee>
+            <q-td align="center">
+              <div class="flex items-center justify-center q-gutter-x-xs">
+                <q-icon
+                  name="mdi-check"
+                  size="sm"
+                  color="suface"
+                  class="cursor-pointer bg-approved"
+                  style="border: 1px solid #c9c9c9; border-radius: 8px"
+                  @click.stop="console.log('edit')"
+                />
+                <q-icon
+                  name="mdi-close-circle-outline"
+                  size="sm"
+                  color="declined"
+                  class="cursor-pointer"
+                  style="border: 1px solid red; border-radius: 8px"
+                  @click.stop="console.log('trash')"
+                />
+              </div>
+            </q-td>
+          </template>
+        </q-table>
+      </div>
+
+      <div class="col-12 col-md-7">
+        <div class="row justify-end q-mb-sm">
+          <q-btn
+            icon="add"
+            color="primary-2"
+            style="height: 40px; width: 40px; border-radius: 8px"
+          />
+        </div>
+        <div class="preview-box q-pa-md">
+          <span v-if="selectedIndex === null" class="text-grey-5"
+            >Pré - Visualização</span
+          >
+          <div v-else>
+            <p class="text-weight-medium q-mb-sm">
+              {{ history[selectedIndex].title }}
+            </p>
+            <p class="text-grey-7" style="white-space: pre-wrap">
+              {{ history[selectedIndex].content }}
+            </p>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
 </template>
+
+<script setup>
+import { ref } from "vue";
+
+const selectedIndex = ref(null);
+
+const columns = [
+  {
+    name: "date",
+    label: "Data",
+    field: "date",
+    align: "left",
+    style: "width: 90px",
+  },
+  { name: "title", label: "Título", field: "title", align: "left" },
+  {
+    name: "actions",
+    label: "Ações",
+    field: "actions",
+    align: "center",
+    style: "width: 90px",
+  },
+  {
+    name: "franchisee",
+    label: "Franqueado",
+    field: "franchisee",
+    align: "left",
+    style: "width: 100px",
+  },
+];
+
+const history = ref([
+  {
+    date: "15/01/2026",
+    title: "Alteração de Razão Social",
+    content: "",
+  },
+]);
+</script>
+
+<style scoped>
+.preview-box {
+  border: 1px solid #e0e0e0;
+  border-radius: 8px;
+  min-height: 400px;
+}
+
+.history-item-active {
+  background-color: rgba(255, 131, 64, 0.08);
+}
+</style>

+ 155 - 1
src/pages/unit/tabs/MediasTab.vue

@@ -1,3 +1,157 @@
 <template>
-  <h1>Mídias</h1>
+  <div class="q-pa-md">
+    <div class="row q-col-gutter-md">
+      <div class="col-12 col-md-5">
+        <q-table
+          :rows="medias"
+          :columns="columns"
+          row-key="title"
+          flat
+          hide-bottom
+          class="bg-transparent"
+          :row-class="
+            (_, index) =>
+              index === selectedIndex
+                ? 'media-item-active cursor-pointer'
+                : 'cursor-pointer'
+          "
+          @row-click="(_, __, index) => (selectedIndex = index)"
+        >
+          <template #body-cell-actions>
+            <q-td align="center">
+              <div class="flex items-center justify-center q-gutter-x-xs">
+                <q-icon
+                  name="mdi-file-edit-outline"
+                  size="sm"
+                  color="grey-8"
+                  class="cursor-pointer"
+                  style="
+                    border: 1px solid #c9c9c9;
+                    border-radius: 8px;
+                    padding: 4px;
+                  "
+                  @click.stop="console.log('edit')"
+                />
+                <q-icon
+                  name="mdi-trash-can-outline"
+                  size="sm"
+                  color="grey-8"
+                  class="cursor-pointer"
+                  style="
+                    border: 1px solid #c9c9c9;
+                    border-radius: 8px;
+                    padding: 4px;
+                  "
+                  @click.stop="console.log('trash')"
+                />
+              </div>
+            </q-td>
+          </template>
+
+          <template #body-cell-franchisee>
+            <q-td align="center">
+              <div class="flex items-center justify-center q-gutter-x-xs">
+                <q-icon
+                  name="mdi-check"
+                  size="sm"
+                  color="suface"
+                  class="cursor-pointer bg-approved"
+                  style="border: 1px solid #c9c9c9; border-radius: 8px"
+                  @click.stop="console.log('edit')"
+                />
+                <q-icon
+                  name="mdi-close-circle-outline"
+                  size="sm"
+                  color="declined"
+                  class="cursor-pointer"
+                  style="border: 1px solid red; border-radius: 8px"
+                  @click.stop="console.log('trash')"
+                />
+              </div>
+            </q-td>
+          </template>
+        </q-table>
+      </div>
+
+      <div class="col-12 col-md-7">
+        <div class="row justify-end q-mb-sm">
+          <q-btn
+            icon="add"
+            color="primary-2"
+            style="height: 40px; width: 40px; border-radius: 8px"
+          />
+        </div>
+        <div class="preview-box q-pa-md">
+          <span v-if="selectedIndex === null" class="text-grey-5"
+            >Pré - Visualização</span
+          >
+          <div v-else>
+            <p class="text-weight-medium q-mb-sm">
+              {{ medias[selectedIndex].title }}
+            </p>
+            <img
+              v-if="medias[selectedIndex].url"
+              :src="medias[selectedIndex].url"
+              style="max-width: 100%; border-radius: 4px"
+            />
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
 </template>
+
+<script setup>
+import { ref } from "vue";
+
+const selectedIndex = ref(null);
+
+const columns = [
+  {
+    name: "date",
+    label: "Data",
+    field: "date",
+    align: "left",
+    style: "width: 90px",
+  },
+  { name: "title", label: "Título", field: "title", align: "left" },
+  {
+    name: "actions",
+    label: "Ações",
+    field: "actions",
+    align: "center",
+    style: "width: 90px",
+  },
+  {
+    name: "franchisee",
+    label: "Franqueado",
+    field: "franchisee",
+    align: "center",
+    style: "width: 100px",
+  },
+];
+
+const medias = ref([
+  {
+    date: "15/01/2026",
+    title: "Imagens Sede",
+    url: "",
+  },
+]);
+</script>
+
+<style scoped>
+.preview-box {
+  border: 1px solid #e0e0e0;
+  border-radius: 8px;
+  min-height: 400px;
+}
+
+.media-item-active {
+  background-color: rgba(255, 131, 64, 0.08);
+}
+
+.transparent-header :deep(thead tr th) {
+  background-color: transparent;
+}
+</style>