-
\ No newline at end of file
diff --git a/src/app/home-page/crud-page/crud-page.component.ts b/src/app/home-page/crud-page/crud-page.component.ts
index 37ca726..8f03b83 100644
--- a/src/app/home-page/crud-page/crud-page.component.ts
+++ b/src/app/home-page/crud-page/crud-page.component.ts
@@ -40,17 +40,20 @@ export class CrudPageComponent implements OnInit {
public hiddenData: String = 'none';
public hiddenTable: String = 'none';
public hiddenSuccess: String = 'none';
+ public hiddenValid: String = 'none';
public alertVisible: any;
public alertNotif: any;
public displayModalEdit: any;
public displayModalAdd: any;
public visibleModal: any;
+
constructor(
public profileDataApi: ProfiledataApi,
public storageCustom: StorageSimpleUploadApi
) {
this.displayModalEdit = 'modal';
this.displayModalAdd = 'modal';
+
this.visibleModal = false;
this.alertNotif = 'none';
@@ -157,25 +160,31 @@ export class CrudPageComponent implements OnInit {
}
public createData() {
- this.folderName = this.fullName + this.makeid().toString();
- console.log(this.folderName, 'FOLDER');
- this.profileDataApi.create({
- fullName: this.fullName,
- address: this.address,
- email: this.email,
- placeOfBirth: this.placeBirth,
- birthDate: this.dateBirth,
- noPhone: this.noPhone,
- folder: this.folderName,
- photoProfile: this.nameFile
- }).subscribe((results) => {
- console.log('Sukses');
-
- this.uploadFoto(this.folderName);
-
- }, (error) => {
- console.log(error);
- });
+ if (this.nameFile === '') {
+ console.log('Sorry Files Is Empty');
+ this.hiddenValid = 'block';
+ this.closedValid();
+ } else {
+ this.folderName = this.fullName + '_' + this.makeid().toString();
+ console.log(this.folderName, 'FOLDER');
+ this.profileDataApi.create({
+ fullname: this.fullName,
+ address: this.address,
+ email: this.email,
+ placeofbirth: this.placeBirth,
+ birthdate: this.dateBirth,
+ nophone: this.noPhone,
+ folder: this.folderName,
+ photoprofile: this.nameFile
+ }).subscribe((results) => {
+ console.log('Sukses');
+
+ this.uploadFoto(this.folderName);
+
+ }, (error) => {
+ console.log(error);
+ });
+ }
}
@@ -203,7 +212,7 @@ export class CrudPageComponent implements OnInit {
console.log('Data');
this.profileDataApi.find({
where: {
- fullName: { 'neq': '' }
+ fullname: { 'neq': '' }
}
}).subscribe((result) => {
console.log(result, 'Data');
@@ -266,6 +275,9 @@ export class CrudPageComponent implements OnInit {
public closeAlert() {
this.hiddenSuccess = 'none';
}
+ public closeValid() {
+ this.hiddenValid = 'none';
+ }
public saveChange(datas) {
console.log(this.idEdit, 'Data');
@@ -334,6 +346,12 @@ export class CrudPageComponent implements OnInit {
}, 3000);
}
+ public closedValid() {
+ setTimeout(() => {
+ this.hiddenValid = 'none';
+ }, 3000);
+ }
+
public editPhoto(event) {
console.log(event);
if (this.nameFile === '') {