Procházet zdrojové kódy

(dynamic rate) Enhance dynamic rate
https://dev.wormwood.com.sg/zentao/task-view-315.html

Change text to open up assign site
https://dev.wormwood.com.sg/zentao/task-view-325.html

Exhaustive list
https://dev.wormwood.com.sg/zentao/task-view-326.html

mass upload template for group
https://dev.wormwood.com.sg/zentao/task-view-328.html

Modify transaction related pages
https://dev.wormwood.com.sg/zentao/task-view-329.html

Upgrade login API to cope with VAPT
https://dev.wormwood.com.sg/zentao/task-view-335.html

vbea před 1 rokem
rodič
revize
0e6fadd956

+ 19 - 19
Strides-Admin/src/api/user.js

@@ -1,23 +1,23 @@
-import request from '@/utils/request'
+import { get, post } from '../http/http'
 
-const MODULE_NAME = "/user/"
+const prefix = "dawn/api/v1/"
 
-function getUserUrl(params) {
-  return MODULE_NAME + params.function
+const user = {
+  login(data) {
+    return post(prefix + "auth/login", data)
+  },
+  sendOTP(data) {
+    return get(prefix + "auth/otp", data)
+  },
+  preLogin(data) {
+    return post(prefix + "auth/pre-login", data)
+  },
+  updatePassword(data) {
+    return post(prefix + "auth/change-password", data)
+  },
+  refreshAuthMenu() {
+    return get(prefix + "auth/resources")
+  }
 }
 
-export function login(data) {
-  return request({
-    url: getUserUrl({ function: 'login' }),
-    method: 'post',
-    data
-  })
-}
-
-export function getInfo(token) {
-  return request({
-    url: '/vue-element-admin/user/info',
-    method: 'get',
-    params: { token }
-  })
-}
+export default user;

+ 5 - 0
Strides-Admin/src/http/api/rates.js

@@ -1,5 +1,7 @@
 import {get, post, put} from '../http'
 
+const prefix = "dawn/api/v1/"
+
 const rates = {
   getRepeatOptions() {
     return get("dynamicRate/getRepeat")
@@ -33,6 +35,9 @@ const rates = {
   },
   unassignRate2Site(data) {
     return post('dynamicRate/unAssignDynamicRateSites', data)
+  },
+  getDynamicRateTypes() {
+    return get(prefix + 'dynamic-rate-type-select')
   }
 }
 

+ 2 - 2
Strides-Admin/src/store/modules/user.js

@@ -1,4 +1,4 @@
-import { login } from '@/api/user'
+import user from '@/api/user'
 import {
   getToken,
   setToken,
@@ -45,7 +45,7 @@ const actions = {
   // user login
   login({ commit }, userInfo) {
     return new Promise((resolve, reject) => {
-      login({
+      user.login({
         email: userInfo.email,
         //userName: userInfo.username.trim(),
         password: userInfo.password,

+ 7 - 2
Strides-Admin/src/views/financial/index.vue

@@ -98,7 +98,7 @@
         align="center"
         prop="chargeBoxId"
         min-width="120"/>
-      <el-table-column
+      <!-- <el-table-column
         label="Vehicle"
         align="center"
         prop="vehicle"
@@ -112,7 +112,12 @@
             {{item}}
           </span>
         </template>
-      </el-table-column>
+      </el-table-column> -->
+      <el-table-column
+        label="Credit Type"
+        prop="creditType"
+        align="center"
+        min-width="150"/>
       <el-table-column
         label="Carpark Code"
         prop="carParkCode"

+ 0 - 1
Strides-Admin/src/views/limit2/detail.vue

@@ -217,7 +217,6 @@ export default {
       this.getStatusOptions();
       this.getLimitInfo();
     }
-    
   },
   methods: {
     onBack() {

+ 1 - 0
Strides-Admin/src/views/limit2/plans.vue

@@ -176,6 +176,7 @@ export default {
     },
     hideAddPlan() {
       this.addPlan.visible = false;
+      this.addPlan.form.planCredit = "";
     },
     addPlanRow() {
       this.addPlan.loading = true;

+ 2 - 2
Strides-Admin/src/views/login/login.vue

@@ -113,7 +113,7 @@ import particles from 'particles.js'
 import animateJson from './animate.json'
 import Password from './Password.vue'
 import OtpView from './otp.vue'
-import api from '@/http/api/user'
+import api from '@/api/user'
 import {parseTime} from '@/utils/index'
 import permission from '@/utils/permission.js'
 const { isNavigationFailure, NavigationFailureType } = VueRouter
@@ -337,7 +337,7 @@ export default {
         })
         this.loading = false
       }).catch((error) => {
-        Message.error(error.message)
+        Message.error(error)
         this.loading = false
         this.handleShowLogin();
       });

+ 1 - 1
Strides-Admin/src/views/login/otp.vue

@@ -32,7 +32,7 @@
 </template>
 
 <script>
-  import api from '@/http/api/user'
+  import api from '@/api/user'
   export default {
     name: "",
     props: {

+ 43 - 7
Strides-Admin/src/views/rate-dynamic/detail.vue

@@ -29,13 +29,31 @@
                 :value="item.value" />
             </el-select>
           </el-form-item>
-          <!-- <el-form-item
+        </div>
+        <div class="flexcr">
+          <el-form-item
             label="Rate Type:"
             prop="rateType"
             class="add-input">
-            <el-input
-              v-model="form.rateType"/>
-          </el-form-item> -->
+            <el-select
+              v-model="form.dynamicRateTypes"
+              multiple>
+              <el-option
+                v-for="item in options.type"
+                :key="item"
+                :label="item"
+                :value="item" />
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            label="Group Discounts Applicable?"
+            prop="rateType"
+            class="add-input">
+            <el-switch
+              v-model="form.groupDiscountOverlay"
+              active-text="YES"
+              inactive-text="NO"/>
+          </el-form-item>
         </div>
         <div class="flexcr">
           <label class="el-form-item__label">Repeat:</label>
@@ -118,7 +136,8 @@
           <div class="section-sub-title">(Currency Used: {{currencyData[form.countryCode]}})</div>
         </div>
         <charge-rate
-          v-model="ratesForm.chargeRates"/>
+          v-model="ratesForm.chargeRates"
+          excludeType/>
       </div>
       <div class="content" v-if="false">
         <div class="section-title flexcr">
@@ -176,9 +195,12 @@ export default {
         startTime: "",
         endTime: "",
         rates: [],
-        specialRates: []
+        specialRates: [],
+        dynamicRateTypes: [],
+        groupDiscountOverlay: false
       },
       options: {
+        type: [],
         country: [],
         repeat: [],
         shortcut: [{
@@ -236,6 +258,7 @@ export default {
   components: {ChargeRate},
   created() {
     this.loading = true;
+    this.getRateTypeOptions();
     this.getCountryOptions();
     this.getRepeatOptions();
     if (this.$route.params.id) {
@@ -283,6 +306,18 @@ export default {
         this.loading = false;
       })
     },
+    getRateTypeOptions() {
+      api.getDynamicRateTypes().then(res => {
+        if (res.data) {
+          this.options.type = res.data
+        }
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+      });
+    },
     getRateDetail() {
       this.loading = true;
       api.getDynamicRateInfo({
@@ -438,7 +473,7 @@ export default {
     width: 100%;
     min-width: 100px;
     max-width: 250px;
-    margin-right: 10px;
+    margin-right: 15px;
     ::v-deep .el-input,
     ::v-deep .el-select {
       width: 100%;
@@ -521,6 +556,7 @@ export default {
     }
     .add-input {
       max-width: unset;
+      margin-right: 0px;
     }
   }
 </style>

+ 15 - 1
Strides-Admin/src/views/rate-dynamic/index.vue

@@ -51,11 +51,25 @@
         label="Rate Name"
         prop="rateName"
         min-width="120"/>
+      <el-table-column
+        align="center"
+        label="Country"
+        prop="country"
+        min-width="100"/>
       <el-table-column
         align="center"
         label="No. of Sites Configured"
         prop="assignedSiteCount"
-        min-width="120"/>
+        min-width="180">
+        <template v-slot="{ row }">
+          <div class="link-type" @click="assignRates(row)">{{row.assignedSiteCount}}</div>
+        </template>
+      </el-table-column>
+      <el-table-column
+        align="center"
+        label="Rate Type"
+        prop="dynamicRateType"
+        min-width="100"/>
       <el-table-column
         align="center"
         label="Status"

+ 21 - 6
Strides-Admin/src/views/site/components/ChargeRate.vue

@@ -28,10 +28,11 @@
           class="rate-text"
           @change="onChange">
           <el-option
-            v-for="item in chargeTypeOptions"
-            :key="item.chargeTypePk"
-            :label="item.chargeType"
-            :value="item.chargeTypePk">
+            v-for="opt in chargeTypeOptions"
+            :key="opt.chargeTypePk"
+            :label="opt.chargeType"
+            :value="opt.chargeTypePk"
+            v-if="isShowType(opt.chargeTypePk, item.chargeTypePk)">
           </el-option>
         </el-select>
       </el-form-item>
@@ -63,7 +64,7 @@
         @click="handleClickSubButton(item, index)"
         src="../../../assets/form-list-sub.png"/>
       <img
-        v-if="chargeRates.length - 1 === index"
+        v-if="chargeRates.length - 1 === index && chargeTypeOptions.length > chargeRates.length"
         class="list-item-icon"
         @click="handleClickAddButton"
         src="../../../assets/form-list-add.png"/>
@@ -90,6 +91,10 @@ export default {
     value: {
       type: Array,
       required: true
+    },
+    excludeType: {
+      type: Boolean,
+      default: false
     }
   },
   model: {
@@ -158,6 +163,16 @@ export default {
     }
   },
   methods: {
+    isShowType(type, pk) {
+      if (this.excludeType && type && type != pk) {
+        for (let item of this.chargeRates) {
+          if (type == item.chargeTypePk) {
+            return false;
+          }
+        }
+      }
+      return true;
+    },
     onChange() {
       this.$emit('change', this.chargeRates);
     },
@@ -181,7 +196,7 @@ export default {
           if (res.data.length > 0) {
             if (!this.chargeRates[0].chargeTypePk)
               this.chargeRates[0].chargeTypePk = res.data[0].chargeTypePk
-            this.tempChargeRate.chargeTypePk = res.data[0].chargeTypePk
+            //this.tempChargeRate.chargeTypePk = res.data[0].chargeTypePk
             this.onChange()
           }
         }

+ 9 - 4
Strides-Admin/src/views/transaction/transactions.vue

@@ -124,6 +124,11 @@
         </template>
       </el-table-column>
       <el-table-column
+        label="Credit Type"
+        prop="creditType"
+        align="center"
+        min-width="120"/>
+      <!-- <el-table-column
         label="Vehicle"
         align="center"
         prop="vehicle"
@@ -137,7 +142,7 @@
             {{item}}
           </span>
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column
         label="Station ID"
         align="center"
@@ -210,14 +215,14 @@
           <span :title="row.totalHour">{{ row.totalHour }}</span>
         </template>
       </el-table-column>
-      <el-table-column
+      <!-- <el-table-column
         label="Total Min"
         align="center"
         min-width="100">
         <template slot-scope="{row}">
           <span :title="row.totalMin">{{ row.totalMin }}</span>
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column
         label="Charges"
         align="center"
@@ -284,7 +289,7 @@ export default {
   created() {
     this.getFilters();
     this.getUserTypeOption();
-    this.handleFilter();
+    //this.handleFilter();
   },
   methods: {
     handleFilter() {

+ 1 - 1
Strides-Admin/src/views/user/detail.vue

@@ -282,7 +282,7 @@ export default {
           message: 'Email is required',
         }],
         phone: [{
-          required: true,
+          required: false,
           trigger: 'blur',
           message: 'Phone Number is required',
         }],