Teacher CRUD

Issue #178 closed
Ghislain Hachey created an issue

We can clone the logic that is in place for schools now – these are the key touchpoints:

1) Verify the API is working for you:

Get -> https://localhost:44301/api/teacher/5976 ( or any id you have)

Optionally (or wait until you have UI to try) : To try creating a new teacher,

POST to https://localhost:44301/api/teacher

Body:

{"tID":null,"tRegister":null,"tPayroll":"80976","tProvident":null,"tDOB":"1980-02-11T00:00:00","tDOBEst":null,"tSex":"M","tNamePrefix":null,"tGiven":"Wilson","tMiddleNames":null,"tSurname":"Tuckey","tNameSuffix":null,"tGivenSoundex":"W425","tSurnameSoundex":"T200","tSrcID":0,"tSrc":null,"tComment":null,"tYearStarted":null,"tYearFinished":null,"tDatePSAppointed":null,"tDatePSClosed":null,"tCloseReason":null,"tPayErr":null,"tPayErrUser":null,"tPayErrDate":null,"tEstErr":null,"tEstErrUser":null,"tEstErrDate":null,"tSalaryPoint":null,"tSalaryPointDate":null,"tSalaryPointNextIncr":null,"tLangMajor":null,"tLangMinor":null,"tpayptCode":null,"tImage":null,"tDateRegister":null,"tDateRegisterEnd":null,"tRegisterEndReason":null,"tShortName":"Wilson Tuckwey","tFullName":"Wilson Tuckwey","tLongName":"Wilson Tuckwey","pCreateDateTime":"2015-08-30T21:19:28.183","pCreateUser":"MicrosoftAccount\\brian@softwords.com.au","pRowversion":"AAAAAAACG2s="}

Then change the surname on the returned teacher:

PUT: https://localhost:44301/api/teacher/<tID>

{"tID":<<TID>>>,"tRegister":null,"tPayroll":"80976","tProvident":null,"tDOB":"1980-02-11T00:00:00","tDOBEst":null,"tSex":"M","tNamePrefix":null,"tGiven":"Wilson","tMiddleNames":null,"tSurname":"Newsurname","tNameSuffix":null,"tGivenSoundex":"W425","tSurnameSoundex":"T200","tSrcID":0,"tSrc":null,"tComment":null,"tYearStarted":null,"tYearFinished":null,"tDatePSAppointed":null,"tDatePSClosed":null,"tCloseReason":null,"tPayErr":null,"tPayErrUser":null,"tPayErrDate":null,"tEstErr":null,"tEstErrUser":null,"tEstErrDate":null,"tSalaryPoint":null,"tSalaryPointDate":null,"tSalaryPointNextIncr":null,"tLangMajor":null,"tLangMinor":null,"tpayptCode":null,"tImage":null,"tDateRegister":null,"tDateRegisterEnd":null,"tRegisterEndReason":null,"tShortName":"Wilson Tuckwey","tFullName":"Wilson Tuckwey","tLongName":"Wilson Tuckwey","pCreateDateTime":"2015-08-30T21:19:28.183","pCreateUser":"MicrosoftAccount\\brian@softwords.com.au","pRowversion":"AAAAAAACG2s="}

Note that you may get some conflict errors along the way, you can cut and paste the returned Rowversion from the conflict (409) response.

ROUTING:

TeacherRoute.ts

Remove the ls version, and copy schoolRoutes.ts, making the appropriate changes.

In particular, you’ll add new routes with urls for teachers/new and teachers/<id>

Teacher.ts

Object representing the Teacher. Copy from Schools.ts. Modify the implementation of IEditable interface.

Also will have just one related array (for now) – Appointments

configRestangularPineapples.ts

Needs to construct the teacher object from the returned data. Copy from Schools (easy).

UI

Create TeacherItem.cshtml in Pineapples\Views\default\Teacher

Copy from SchoolItem.cshtml to get the overall structure that will work with the EditLayout.

This is what we have now in the desktop app:

Personal information is the main thing here to be concerned with, note that TPF no and NPF number are vocabs for the payroll no and Provident Fund number – you’ll find them in the SIEMIS sysVocab table.

The 5-part name is a neat little gadget that dynamically parses and splits the name as you type it – would be a nice-to-have down the track but I’ll show you that in Honiara.

Once you have all that, you should be ready to navigate to

/#/teachers/<<teacherID>>

And get the display.

Access from List

Take a look at SchoolFilter.ts, note the cellTemplate in the default list view for schNo:

module Pineapples {

  let viewDefaults = {

    columnSet: 0,
    columnDefs: [
      {
        field: 'schNo', name: 'Sch No',
        editable: false,
        width: 80, pinnedLeft: true,
        cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><a  ng-click="grid.appScope.listvm.action(\'item\',col.field, row.entity);">{{row.entity[col.field]}}</a></div>'
      },

Apply this to the Teacher default view, wrapping teacher name , to get the ng-click to invoke the “item” action (this will change to the item state below the current state, ie site.teachers.list.item).

So a few steps there – but all are relatively straightforward. Use fiddler to be clear on what data you are sending and receiving at each stage.

Comments (2)

  1. Ghislain Hachey reporter

    While this will be necessary for countries without any existing HR system to manage their teachers and teacher related data. It is not the case currently in RMI. It was decided for the time being that all teacher data is managed at the HR system level. Data is sync'ed one way from that system to the EMIS greatly simplifying the process. Exposing the teacher data in the EMIS provides another mean to improve data quality. Maybe a useful feature would be a way for principals and teachers to "flag" outdates or wrong data through automated notifications to the HR system team.

  2. Ghislain Hachey reporter

    Read-only teacher is under progress. The way forward should be discussed. Moving teacher feature related discussions to #190.

  3. Log in to comment