1/**
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15import DeviceUtil from '../../utils/DeviceUtil';
16import router from '@system.router';
17import QueryReportController from './queryReportController';
18import WantUtil from '../../utils/WantUtil';
19
20@Entry
21@Component
22struct queryReport {
23    @StorageLink('QueryReportController') queryReportController: QueryReportController = QueryReportController.getInstance();
24    private gridColumns: GridRowColumnOption = { sm: 4, md: 8, lg: 12 };
25    private girdSpan: GridColColumnOption = { sm: 4, md: 8, lg: 12 };
26    private gridGutter: string = '24vp';
27    private gridMargin: string = '24vp';
28
29    onPageShow(): void  {
30        this.queryReportController.onShow();
31        WantUtil.getWant();
32    }
33
34    aboutToAppear(): void {
35        this.queryReportController.onInit()
36    }
37
38    build() {
39        Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
40            Row() {
41                Image($rawfile('icon/ic_message_back.svg'))
42                    .width(24)
43                    .height(24)
44                    .onClick(() => {
45                        router.back()
46                    })
47                Text($r('app.string.send_reports'))
48                    .margin({ left: 16 })
49                    .fontSize(20)
50                    .fontWeight(FontWeight.Bold)
51                    .lineHeight(28)
52            }
53            .alignItems(VerticalAlign.Center)
54            .height(56)
55
56            Column() {
57                Text() {
58                    Span($r('app.string.putAddresser')).fontSize(16)
59                    Span(this.queryReportController.telephone).fontSize(16)
60                }
61                .fontSize(16)
62                .height(48)
63                .fontWeight(FontWeight.Medium)
64                .lineHeight(22)
65
66                Text() {
67                    Span($r('app.string.Status')).fontSize(16)
68                    Span(this.queryReportController.sendStatusDesc).fontSize(16)
69                }
70                .fontSize(16)
71                .height(48)
72                .fontWeight(FontWeight.Medium)
73                .lineHeight(22)
74
75                if (!this.queryReportController.isMsm && this.queryReportController.sendStatus != 2) {
76                    Text() {
77                        Span($r('app.string.Delivered')).fontSize(16)
78                        Span(this.queryReportController.mmsTime).fontSize(16)
79                        Span(' ')
80                        Span(this.queryReportController.specificTime).fontSize(16)
81                    }
82                    .fontSize(16)
83                    .height(48)
84                    .fontWeight(FontWeight.Medium)
85                    .lineHeight(22)
86                }
87            }
88            .alignItems(HorizontalAlign.Start)
89            .padding({ left: 12, right: 12 })
90
91        }
92        .width('100%')
93        .height('100%')
94        .margin({ left: this.gridMargin, right: this.gridMargin })
95    }
96}