浏览代码

2. Keterangan di notifikasinya gagal, tapi laporan masuk
3. Jika gagal kirim laporan dan publik tidak mengisi no telp, maka keterangan pada notifikasinya "laporan tidak terkirim"
4. Indikator loading saat proses mengirim laporan

andi 2 年之前
父节点
当前提交
04f1b3f4e7
共有 1 个文件被更改,包括 34 次插入6 次删除
  1. 34 6
      pages/laporan/new/index.js

+ 34 - 6
pages/laporan/new/index.js

@@ -755,7 +755,21 @@ class App extends Component {
                     this.setState({ disablekirim3: false, disablecancel: false })
                     this.setState({ disablekirim3: false, disablecancel: false })
                   }}
                   }}
                 >
                 >
-                  <span className="font-color-white">Kirim</span>
+                  {this.state.loading ?
+                    (
+                      <div class="d-flex justify-content-center">
+                        <span
+                          class="spinner-border spinner-border-sm text-white"
+                          role="status"
+                        ></span>
+                        <span className="font-color-white">
+                          &nbsp; Diproses...
+                        </span>
+                      </div>
+                    ) : (
+                      <span className="font-color-white">Kirim</span>
+                    )}
+
                 </Button>
                 </Button>
               </ModalFooter>
               </ModalFooter>
             </form>
             </form>
@@ -805,19 +819,33 @@ class App extends Component {
                   <span className="font-color-white">Cancel</span>
                   <span className="font-color-white">Cancel</span>
                 </Button>
                 </Button>
                 <Button
                 <Button
-                  className="btn-login bg-success"
+                  className="bg-success float-lg-right"
                   color
                   color
                   disabled={this.state.disablekirim}
                   disabled={this.state.disablekirim}
                   onClick={async () => {
                   onClick={async () => {
-                    this.setState({ disablecancel: true })
+                    this.setState({ disablecancel: true, loading2: true })
                     await this.createLaporan(this.state.token);
                     await this.createLaporan(this.state.token);
                     this.setState({ disablecancel: false })
                     this.setState({ disablecancel: false })
 
 
                   }}
                   }}
                 >
                 >
-                  <span className="font-color-white">
-                    Kirim
-                  </span>
+                  {this.state.loading2 ?
+                    (
+                      <div class="d-flex justify-content-center">
+                        <span
+                          class="spinner-border spinner-border-sm text-white"
+                          role="status"
+                        ></span>
+                        <span className="font-color-white">
+                          &nbsp; Diproses...
+                        </span>
+                      </div>
+                    ) : (
+                      <span className="font-color-white">
+                        Kirim
+                      </span>
+                    )}
+
                 </Button>
                 </Button>
               </ModalFooter>
               </ModalFooter>
             </form>
             </form>