Commit b174a52f by Sirasit.y

mylearn สร้างบริษัท : บังคับใส่ email สำหรับ register users , role , member of admin

parent 53515310
......@@ -7,6 +7,7 @@ export interface HrcompanyModel {
companyCode: string;
companyName: string;
companySource: string;
companyEmail: string;
branchId: string;
branchName: string;
pictureUrl: string;
......@@ -32,6 +33,7 @@ export class MyHrcompanyModel extends BaseModel implements HrcompanyModel {
companyCode: string;
companyName: string;
companySource: string;
companyEmail: string;
branchId: string;
branchName: string;
pictureUrl: string;
......@@ -57,6 +59,7 @@ export class MyHrcompanyModel extends BaseModel implements HrcompanyModel {
this.companyCode = data?.companyCode!
this.companyName = data?.companyName!
this.companySource = data?.companySource!
this.companyEmail = data?.companyEmail!
this.branchId = data?.branchId!
this.branchName = data?.branchName!
this.pictureUrl = data?.pictureUrl!
......
......@@ -216,6 +216,33 @@
{{'Please fill in information' | translate}}
</div>
</div>
<div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<label for="deal-title" class="form-label">{{ 'อีเมลบริษัท' | translate}}</label>
<input type="text"
class="form-control"
id="deal-title"
name="companyEmail"
placeholder=""
required
pattern="^[^\s@]+@[^\s@]+\.[^\s@]+$"
[(ngModel)]="selectHrcompanyModel.companyEmail"
[ngModelOptions]="{ updateOn: 'change' }"
#companyEmailCtrl="ngModel">
<div class="text-danger" *ngIf="companyEmailCtrl.errors?.['required']">
{{ 'Please fill in information' | translate }}
</div>
<div class="text-danger" *ngIf="companyEmailCtrl.errors?.['pattern']">
{{ 'อีเมลไม่ต้องถูก' | translate }}
</div>
</div>
<div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<label for="deal-title" class="form-label">{{ 'โลโก้บริษัท' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="selectHrcompanyModel.logo">
</div>
<div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<label for="deal-title" class="form-label">{{ 'ที่อยู่บริษัท' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="selectHrcompanyModel.companyAddr">
......@@ -224,18 +251,14 @@
<label for="deal-title" class="form-label">{{ 'เบอร์ติดต่อบริษัท' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="selectHrcompanyModel.companyTel">
</div>
<div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<label for="deal-title" class="form-label">{{ 'โลโก้บริษัท' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="selectHrcompanyModel.logo">
</div>
<div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<!-- <div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<label for="deal-title" class="form-label">{{ 'รหัสหน่วยงาน' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="selectHrcompanyModel.branchId">
</div>
<div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<label for="deal-title" class="form-label">{{ 'ชื่อหน่วยงาน' | translate}}</label>
<input type="text" class="form-control" id="deal-title" placeholder="" [(ngModel)]="selectHrcompanyModel.branchName">
</div>
</div> -->
<div class="xl:col-span-12 col-span-12 my-2" *ngIf="statusHrcompanyModel=='add'">
<label for="deal-title" class="form-label">{{ 'แหล่งที่มาบริษัท' | translate}}</label>
......
......@@ -158,6 +158,7 @@ export class MyhrcompanyComponent implements OnInit {
this.selectHrcompanyModel.companyCode = '';
this.selectHrcompanyModel.companyName = '';
this.selectHrcompanyModel.companySource = 'MyLearn'; // default
this.selectHrcompanyModel.companyEmail = '';
this.selectHrcompanyModel.branchId = '';
this.selectHrcompanyModel.branchName = '';
this.selectHrcompanyModel.logo = '';
......@@ -186,7 +187,8 @@ export class MyhrcompanyComponent implements OnInit {
buttons: ['ยกเลิก', 'ยืนยัน'],
}).then((willSave: any) => {
if (willSave) {
this.myhrcompanyservice.postMyHRcompany(this.selectHrcompanyModel)
const action = this.action === 'add' ? 'true' : 'false';
this.myhrcompanyservice.postMyHRcompany(this.selectHrcompanyModel,action)
.subscribe(
(result) => {
console.log(result);
......
......@@ -25,7 +25,7 @@ export class MyhrcompanyService {
return this.http.get<HrcompanyModel[]>(this.urlApi + '/lists');
}
postMyHRcompany(body: HrcompanyModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body);
postMyHRcompany(body: HrcompanyModel, action?: string): Observable<AlertModel> { // action = 'true' จะให้ทำ process สร้าง user member -> admin ให้เลย
return this.http.post<AlertModel>(this.urlApi + '?action=' + action, body);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment