From b4d1fb8b8e6e6cdb7be76a2d4fa0d2b9a84f3ba2 Mon Sep 17 00:00:00 2001
From: Vitalii Lysak <v.lysak@dunice.net>
Date: Wed, 10 Aug 2022 15:46:15 +0300
Subject: SILABMC-236: upd layput for ReadOnly role

---
 src/views/_sila/Overview/DateTime/DateTime.vue | 33 +++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 6 deletions(-)

(limited to 'src/views/_sila/Overview/DateTime/DateTime.vue')

diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue
index 796a57ac..e9de12c5 100644
--- a/src/views/_sila/Overview/DateTime/DateTime.vue
+++ b/src/views/_sila/Overview/DateTime/DateTime.vue
@@ -42,6 +42,7 @@
             v-model="form.configurationSelected"
             value="manual"
             data-test-id="dateTime-radio-configureManual"
+            :disabled="$store.getters['authentication/role'] === 'ReadOnly'"
           >
             {{ $t('pageDateTime.form.manual') }}
           </b-form-radio>
@@ -57,7 +58,10 @@
                     id="input-manual-date"
                     v-model="form.manual.date"
                     :state="getValidationState($v.form.manual.date)"
-                    :disabled="ntpOptionSelected"
+                    :disabled="
+                      ntpOptionSelected ||
+                      $store.getters['authentication/role'] === 'ReadOnly'
+                    "
                     data-test-id="dateTime-input-manualDate"
                     class="form-control-with-button"
                     @blur="$v.form.manual.date.$touch()"
@@ -81,7 +85,10 @@
                       $t('global.calendar.useCursorKeysToNavigateCalendarDates')
                     "
                     :title="$t('global.calendar.selectDate')"
-                    :disabled="ntpOptionSelected"
+                    :disabled="
+                      ntpOptionSelected ||
+                      $store.getters['authentication/role'] === 'ReadOnly'
+                    "
                     button-variant="link"
                     aria-controls="input-manual-date"
                   >
@@ -106,7 +113,10 @@
                     id="input-manual-time"
                     v-model="form.manual.time"
                     :state="getValidationState($v.form.manual.time)"
-                    :disabled="ntpOptionSelected"
+                    :disabled="
+                      ntpOptionSelected ||
+                      $store.getters['authentication/role'] === 'ReadOnly'
+                    "
                     data-test-id="dateTime-input-manualTime"
                     @blur="$v.form.manual.time.$touch()"
                   />
@@ -126,6 +136,7 @@
             v-model="form.configurationSelected"
             value="ntp"
             data-test-id="dateTime-radio-configureNTP"
+            :disabled="$store.getters['authentication/role'] === 'ReadOnly'"
           >
             NTP
           </b-form-radio>
@@ -140,7 +151,10 @@
                     id="input-ntp-1"
                     v-model="form.ntp.firstAddress"
                     :state="getValidationState($v.form.ntp.firstAddress)"
-                    :disabled="manualOptionSelected"
+                    :disabled="
+                      manualOptionSelected ||
+                      $store.getters['authentication/role'] === 'ReadOnly'
+                    "
                     data-test-id="dateTime-input-ntpServer1"
                     @blur="$v.form.ntp.firstAddress.$touch()"
                   />
@@ -165,7 +179,10 @@
                     id="input-ntp-2"
                     v-model="form.ntp.secondAddress"
                     :state="getValidationState($v.form.ntp.secondAddress)"
-                    :disabled="manualOptionSelected"
+                    :disabled="
+                      manualOptionSelected ||
+                      $store.getters['authentication/role'] === 'ReadOnly'
+                    "
                     data-test-id="dateTime-input-ntpServer2"
                     @blur="$v.form.ntp.secondAddress.$touch()"
                   />
@@ -187,7 +204,10 @@
                     id="input-ntp-3"
                     v-model="form.ntp.thirdAddress"
                     :state="getValidationState($v.form.ntp.thirdAddress)"
-                    :disabled="manualOptionSelected"
+                    :disabled="
+                      manualOptionSelected ||
+                      $store.getters['authentication/role'] === 'ReadOnly'
+                    "
                     data-test-id="dateTime-input-ntpServer3"
                     @blur="$v.form.ntp.thirdAddress.$touch()"
                   />
@@ -204,6 +224,7 @@
             variant="primary"
             type="submit"
             data-test-id="dateTime-button-saveSettings"
+            :disabled="$store.getters['authentication/role'] === 'ReadOnly'"
           >
             {{ $t('global.action.saveSettings') }}
           </b-button>
-- 
cgit v1.2.3

